• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error while uploading multiple image files

#1
Question 
Hello,




I've been trying to upload multiple images using CI's (version 3.1.11) File Uploading Class with partial success so far.




I say "partial", because as long as I do not select more than 4 files everything goes fine. Images get uploaded without any errors. If I select 5 or more images I get "The action you have requested is not allowed." error.






These are the files:


          File name                     Size in KB

  • 20191030_162750.jpg 1664
  • 20191030_162827.jpg 1768
  • 20191030_162850.jpg 1680
  • 20191030_162815.jpg 1720
  • 20191030_162833.jpg 1632
  • 20191030_162915.jpg 1700
  • 20191030_162821.jpg 1948
  • 20191030_162838.jpg 1772



I tried several different combination of 4 files, they all worked. When I select more than 4 then it fails with the error message I mentioned above.




This is the HTML form code:



Code:
echo form_open_multipart('', ['id'   => 'frm_photos', 'class'=> 'form-horizontal']);

echo'<input type="file" name="photos[]" multiple class="form-control" />';

echo'<input type="submit" id="submit_button" value="Upload" class="btn btn-lg btn-primary btn-block" />';

echo'</form>';





The error message looks as though it may be related to CSRF protection which is enabled in the CI's config.php.



CI version is 3.1.11






Anybody has an idea why this may be happening ?




Thanks,
Reply

#2
It may be your php.ini settings.

Code:
php.ini File:

memory_limit = 256M
upload_max_size = 64M
post_max_size = 64M
upload_max_filesize = 64M
max_execution_time = 300
max_input_time = 1000

=================================

.htaccess file:

php_value memory_limit 256M
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 1000

Try one of the above and see if it fixes your problem.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
(11-05-2019, 09:11 AM)InsiteFX Wrote: It may be your php.ini settings.

Code:
php.ini File:

memory_limit = 256M
upload_max_size = 64M
post_max_size = 64M
upload_max_filesize = 64M
max_execution_time = 300
max_input_time = 1000

=================================

.htaccess file:

php_value memory_limit 256M
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 1000

Try one of the above and see if it fixes your problem.

It was
Code:
post_max_size = 64M

Mine was set to 8M which was too small.

Thanks
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.