Skip to content Skip to sidebar Skip to footer

Upload Folders To Server With Javascript

My apologies because my first post did not meet the standards of the site I replay my issue Am trying to upload a folder with more than 200 files with JavaScript & php. The is

Solution 1:

PHP has a configuration setting, that limits how many file uploads will be accepted in such a POST request.

It’s named max_file_uploads, and the default value is 20.

https://www.php.net/manual/en/ini.core.php#ini.max-file-uploads

Note that the “changeable mode” is shown as PHP_INI_SYSTEM there - which means, it can only be set in set in php.ini or httpd.conf. So if you are not in control of the server, you will have to ask your server admin / hosting provider, if they can change this for you.

This is also mentioned in the common pitfalls sub-chapter of the explanation of how file uploads work,

As of PHP 5.2.12, the max_file_uploads configuration setting controls the maximum number of files that can uploaded in one request. If more files are uploaded than the limit, then $_FILES will stop processing files once the limit is reached. For example, if max_file_uploads is set to 10, then $_FILES will never contain more than 10 items.

Solution 2:

There are a number of PHP parameters that act roughly together in this area

// the max number of file that PHP will accept from upload// as it cannot know how many the browser is sending until it gets them// php just Stops processing at this number of files
max_file_uploads = 20// the max size of any one file that will be accepted
upload_max_filesize = 2M

// as files are transmitted using POST, this param should also be checked// it should be large enough to cope with all the files uploaded// So basic calc, assuming all files wont be the max size would be// post_max_size = max_file_uploads  * upload_max_filesize //// However you also have to make room for all the normal html form parameters // that may come as well as the file(s)//// so // post_max_size = max_file_uploads  * upload_max_filesize + 8M as a guestimate
post_max_size = 8M    

// of course as all this will occupy memory in PHP while it processes all the// files and other field inputs it should be large enough to cope with // all the file and of course some room for the program code
memory_limit = 128M

Ignore the numbers in these params, they are just placeholders, not my suggestions for your system, those you will have to work out for yourself

As you are using WAMPServer you have access to amend all these parameters in the php.ini file. However, a warning, if you intend to move this code to a shared hosting eventually, you may not have access to these parameters. So be careful when designing a system with large requirements, it may force you to spend more on the eventual home of this code.

And finally, when you change these parameters in the php.ini file, remember to bounce Apache so the new values get picked up.

wampmanager->Apache->Service Administration->Restart Service

Post a Comment for "Upload Folders To Server With Javascript"