javascript - Multiple File Upload using array -


i have website people can upload image file. allow users upload multiple image files. find bit confusing make functions accept arrays. here have :

the ui part of it:

<input type="file" id="imagefile" name="imagefile[]" multiple> 

the handler function , used logging txt file:

if(getpostputfield('imagefilename',$imagefilename)) $count=1; foreach ($_files['imagefilename']['tmp_name'] $file) { $imagefilename = urldecode($imagefilename); $uploaded = handleuploadedimagefile($kbid, $_files['imagefile'], $imagefilename); if ($uploaded) { $changesforeveryone[] .= "image file uploaded: " . $imagefilename."<br>"; $extramsg .= "<br>image file uploaded: " . $imagefilename."<br>"; } $count++; } 

the part file uploaded:

function handleuploadedimagefile($kbid,$file,$imagefilename=null) { $result = '';       if(empty($imagefilename)) $imagefilename = $file['name']; if($file['size'] > 0) { $dir = problemimages."/".sprintf("%05d",$kbid)."/"; $result = getuploadedfile($file['tmp_name'],$dir,$imagefilename); } else { $result = false; } return $result; } 

how do properly?

if have upload files in single request can @ answer here
in order create better user experience better upload files 1 one using ajax take @ "jquery file upload demo" (you can find there server side code in php)


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -