php - Trying to upload files from a form that is allowing more inputs -


i need allow admin upload many images in admin area. using code allows them press link , adds upload button. post php script upload files. however, it's not uploading them, it's not printing error message. great.

here snip-it of form code:

<tr> <td width="280" bgcolor="#e1e1e1"><font color="#000000">product image:</font></td> <td width="615" bgcolor="#e1e1e1"> <div id="newlink"> <div class="feed"> <input name="image[]" type="file" /> </div> </div> <p id="addnew"> <a href="javascript:add_feed()">add image </a> </p> <div id="newlinktpl" style="display:none"> <div class="feed"> <input name="image[]" type="file" /> </div> </div> </td></tr> 

here php code upload files:

$len = count($_post['image']);     ($i=0; $i < $len; $i++)     {     $imagefile=$_post['image'][$i];         //if ($i == 0){$imgfile = $_post['image'][$i];}         //else {$imgfile = $imgfile."|".$_post['image'][$i];}  $target2 = "../lp/companyuploads/images/"; $target2 = $target2 . basename( $_files[$imagefile]['name']) ;  $ok=1;   # limit file type condition   if ($uploaded_type =="text/php"){   echo "no php files<br>";   $ok=0;   }   # check $ok not set 0 error   if ($ok==0){   echo "sorry pdf file not uploaded";   }   # if ok upload   else {  if(move_uploaded_file($_files[$imagefile]['tmp_name'], $target2)) {  $name = basename( $_files[$imagefile]['name']) ;  # show success on screen echo <<<end <font size="+1" color="blue" face="arial">$name has been uploaded successfully.</font> end;  }   else   {   echo "the ".$namefile." not saved correctly, please let randy know got error.";   }   }   } 


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -