php - codeigniter multiple file upload at once using a single input fieldGet the solution ↓↓↓
I am having a problem in uploading multiple files at once using a single input field,
My HTML form looks like this
<form method="post" action="upload.php" enctype="multipart/form-data"> <input type="file" name="files" multiple/> <input type="submit" /> </form>
In my controller I am checking like this
echo "<pre>; print_r($_FILES); die;
And when I select 2 pdf files, I am getting the output like this
Array ( [files] => Array ( [name] => Array (  => myfile.pdf ) [type] => Array (  => ) [tmp_name] => Array (  => ) [error] => Array (  => 1 ) [size] => Array (  => 0 ) ) )
I should be getting 2 array in the output right? So, what is the problem here?
try the following code in your controller:
echo "<pre>"; $_FILES['files']; // change over here die();
If that didn't work, following should work
Also take a look at here
Error value 1 : UPLOAD_ERR_INI_SIZE The uploaded file exceeds the upload_max_filesize directive in php.ini. (- source)
You can set those within your code by
ini_set('max_file_uploads',1000); ini_set('post_max_size','5000M'); ini_set('upload_max_filesize','5000M');
People are also looking for solutions of the problem: malformed utf-8 characters, possibly incorrectly encoded
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.