Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

196
Views
How to show image after submitting (HTML,,& JS)

this is my HTML and JavaScript codes

HTML CODE

<h1>Input element</h1>
<form action=" ">
    <input type="file" name="picture" accept="image/*" onChange="loadfile(event)">
    <label for="file">UpLoad</label>
    <input type="submit">
</form>
<img id="pics" width="200px" height="200px" style="display: none;">

JavaScript Code

<script>
        var loadfile = function(event){
            var image = document.getElementById('pics');
            image.style.display = "block";
            image.src = URL.createObjectURL(event.target.files[0]);
        };
</script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to receive an image on the server with the code same as below on php:

<?php
function get_uploadFile() {
    $upload_path = 'upload-path/';
    $upload_filename = $upload_path . basename($_FILES['uploadFile']['name']);
    if (move_uploaded_file($_FILES['uploadFile']['tmp_name'], $upload_filename)) {
        return $upload_filename;
    } else {
        return false;
    }
}
if ($src = get_uploadFile()) {
    echo '<img src="' . $src . '">';
} else {
    echo 'Error uploading file!';
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!