Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple File Upload PHP
    text
    copied!<p>I use the Following code to upload a single file .With This code I can Upload a single file to the database .I want to make multiple files uploaded by selecting multiple files in a single <strong>input type file</strong>.What Changes should i make in the code to make it upload multiple files?</p> <pre><code>&lt;?PHP INCLUDE ("DB_Config.php"); $id=$_POST['id']; $fileTypes = array('txt','doc','docx','ppt','pptx','pdf'); $fileParts = pathinfo($_FILES['uploaded_file']['name']); if(in_array($fileParts['extension'],$fileTypes)) { $filename = $_FILES["uploaded_file"]["name"]; $location = "E:\\test_TrainingMaterial/"; $file_size = $_FILES["uploaded_file"]["size"]; $path = $location . basename( $_FILES['uploaded_file']['name']); if(file_exists($path)) { echo "File Already Exists.&lt;br/&gt;"; echo "Please Rename and Try Again"; } else { if($file_size &lt; 209715200) { $move = move_uploaded_file( $_FILES["uploaded_file"]["tmp_name"], $location . $_FILES['uploaded_file']['name']); $result = $mysqli-&gt;multi_query("call sp_upload_file('".$id."','" . $filename . "','".$path."')"); if ($result) { do { if ($temp_resource = $mysqli-&gt;use_result()) { while ($row = $temp_resource-&gt;fetch_array(MYSQLI_ASSOC)) { array_push($rows, $row); } $temp_resource-&gt;free_result(); } } while ($mysqli-&gt;next_result()); } if($move) { echo "Successfully Uploaded"; } else { echo "File not Moved"; } } else { echo "File Size Exceeded"; } } } else { echo " Invalid File Type"; } ?&gt; </code></pre> <p>The Html That is used is</p> <pre><code>&lt;form id = "upload_form" method="post" enctype="multipart/form-data" &gt; &lt;input type="file" name="uploaded_file" id="uploaded_file" style="color:black" /&gt;&lt;br/&gt; &lt;/form&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload