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

211
Views
Error during uploading file in folder and database

Warning: Undefined array key "image" Showing this error when I'm uploading files in folder and database, I guess my code has mistake.

HTML CODE

<form action="image.php" method="post">
  <div class="row">
    <div class="col">
      <div class="avatar-upload">
        <div class="avatar-edit">
           <input type='file' id="imageUpload" name="image[]" accept=".png, .jpg, .jpeg" />
           <label for="imageUpload"></label>
        </div>
        <div class="avatar-preview">
         <div id="imagePreview" name="image[]"style="background-image: url('../../images/<? 
           =getuserimagesinfo($db,$user['id'])?>');">
        </div>
      </div>
    </div>
  </div>
</form>

Javascript

 function readURL(input) {
   if (input.files && input.files[0]) {
     var reader = new FileReader();
     reader.onload = function(e) {
         $('#imagePreview').css('background-image', 'url('+e.target.result +')');
         $('#imagePreview').hide();
         $('#imagePreview').fadeIn(650);
         }
          reader.readAsDataURL(input.files[0]);
         }
   }
    $("#imageUpload").change(function() {
        readURL(this);
 });

PHP Code

    $image_name=$_FILES['image']['name']; //Storing image name
    $img_tmp=$_FILES['image']['tmp_name'];
    print_r($image_name);
    print_r($img_tmp);

If I am inserting name="image[]" in wrong input then please suggest me one, Thanks in advance

about 4 years ago · Juan Pablo Isaza
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!