Wordpress Max File Upload Problem - php

I have created a wordpress custom post type. I am using custom field template to create fields. I have created a file field to upload images. When I upload files then It work like a charm but only 20 files get uploaded and other files get ignored. I know Its a php configuration and I have override the configuration by putting a php.ini file on my server root. Here is what I have done in it.
max_file_uploads = 300
When I run this command to check the configuration values:
echo "max_file_uploads: " . ini_get('max_file_uploads');
Then in output I get 300. But still I am unable to upload more then 20files in a single post. Am I missing something?
P.S I have a shared server and the files I am uploading have max size upto 1.5KB

Check my comment on your question above. Consider having an upload helper like fileuploader. This way, every upload is a request so no limit is reached.
Uploadify allows you to drag&drop files and select multiples files to upload (although they are sent one by one).

I had this same problem, although mine was limited to 25. The issue was the default suhosin.upload.max_uploads setting was set to 25, and like PHP versions before 5.3.4, empty upload fields would count towards this total.
The solution was to override the default suhosin.upload.max_uploads setting after it is included in php.ini. Look for the line extension="suhosin.so" and make sure it is somewhere after that.

Related

What is the maximum file size allowed to send through REST API

Is there a restriction on the file size to send through the REST API?
I have a file field in a web form in my Drupal Website and sending the uploaded file to the SugarCRM application through REST API using base64_encode function.
This is working fine for the small files. But when we try to upload files around 2 MB the file, it is sending an empty value.
Is there a limit on file size that can be sent through REST API? If so, is there any other way I can send a big file(at least 2MB) to my SugarCRM application?
Google did not help me this time. If someone could, that would be great.
If you have root access on your machine, this is the most reliable and universal approach to increasing the maximum file upload. Find the php.ini file. The most common location for php.ini is /etc/php.ini. If the file is not there, you can determine where php.ini lives by using the phpinfo() function.
Once you've located php.ini, there are two settings you need to change, the max post size and max file upload size.
Maximum size of POST data that PHP will accept.
post_max_size = 2M;
Maximum allowed size for uploaded files.
upload_max_filesize = 2M;
Change these values to the maximum upload size you would like to allow. After making the changes check that the changes have been applied by checking phpinfo()
in your admin panel, you need to edit upload.php file to increase the input upload value size.
your question is not clear, if you can - provide some code's that's are creating problems or post a error logs.

Wordpress: 413 Request Entity Too Large

I have a WP site managed on an Ubuntu server with Plesk.
For a few hours I can not upload files above 2MB.
I have made several attempts like:
Change the settings from php.ini (verifying via phpinfo () that they were set correctly).
Both through Plesk and manually;
Change different PHP versions (from 5.6, 7.0.x, 7.1.x, to 7.2.x);
Disabled firewall;
Tested with different types and name files;
Set the upload limit with nginx (either manually or via plesk);
Tried to set the limit via .htaccess and / or wp-config;
Updated WP, ​​plugins and themes;
Disabled all plugins;
Try to decrease the upload limit to 1 MB (in this case it displayed the limit and did not allow me to proceed with the upload);
Tested by other PC / browsers.
On other sites uploaded to the same server, with the same settings (one is the backup of the site in question) instead I can correctly upload the files.
On the file upload screen I see the upload limit correctly (for example 64M) but if I upload a file greater than 2MB I see the error:
413 Request Entity Too Large
What could it be? Do you have any ideas / suggestions on this?
Thanks a lot!
Most probably that the reason of this issue is ModSecurity settings. Check solution from https://support.plesk.com/hc/en-us/articles/115001764933-Unable-to-edit-document-on-the-website-ModSecurity-Request-body-no-files-data-length-is-larger-than-the-configured-limit-
To fix, you need to set server block like this
server {
client_max_body_size 0;
...

Can't upload large file in Laravel (php.ini settings are correct in my opinion)

I have the following problem in Laravel.
I would like to upload a file through a form. But for some reason if the file is larger than around 2100 KB, the validation fails, and says that the file is 'required' and I did not provide it.
I've read numerous articles, that this can be because of php.ini settings. On my server they are the following:
upload_max_filesize 64M
post_max_size 64M
These values are copied from the output of phpinfo(), so they are in effect.
And despite this, the upload fails even for a 2 MB file. Do you have any ideas what I could check/set to solve this?
I am using laravel 5.2, and PHP 7.
Check which server software you are using. Nginx for instance has it's own limit (default set to 1MB I believe). Apache might have it too. Consult the respective manuals for those packages on how to configure them. Or if you're using shared hosting, contact support to see if they can increase the limit.
Though this isn't a really scalable solution. Next time you might want to upload a 100MB file, and you probably don't want to allow 100MB requests on your servers. A better approach would be to split the file in smaller chunks in the frontend, with JavaScript, and submit them as parts of the same upload, then recombine the parts on the server once the file is completely uploaded. Beware of additional checks you'll have to do here though.
You might want to incorporate the following into your own code:
<?php
//--- this tries to override the default of only 2M file uploads.
ini_set("upload_max_filesize","25M");
ini_set("max_execution_time",600); //--- 10 minutes
ini_set("post_max_size","35M");
ini_set("file_uploads","On");
?>
In my case, it was HDD space issue. not enough space to store the file.
Laravel should handle it with proper message, instead of indicating user didn't upload anything.
If you are not using any other package to upload files to check , then
then remember to restart apache .

plupload example gets 103 error

I am playing with plupload 2.1.3 and can't get it to complete an upload using their custom example. I get a 103, unable to move uploaded file. If I look in the upload directory I see the file I tried to upload listed as test.png.part. My php.ini lists /tmp as my upload_tmp_dir.
From this I gather that the permissions are correct (I even set everything to 777 temporarily -- go difference).
This is a fairly newly configured server so it may not be related to plupload.
You have to check your PHP configurations on php.ini file.
If your upload is constantly being interrupted you either need to increase the maximum upload size or the time before your PHP script times out. Check this variables:
post_max_size
upload_max_filesize
max_execution_time
You can either increase in your PHP configuration file or increase in your script using the ini_set function. Check the manual for more details. PHP Manual

Increase file upload size but cannot locate/access php.ini

I'm testing a file uploading page etc that I'm working on. Chose a largish file at random and received:
Request Entity Too Large
The requested resource
/admin.php
does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.
as an error message. Brief google led to changing values in php.ini but I can't locate or access it.
The site is hosted on a free site 000.webhosting.org - I'm guessing they have it restricted somehow. Is there a workaround?
Create an .htaccess document and put it in you document root directory. Inside, place:
php_value upload_max_filesize 10M
Source: http://www.cyberciti.biz/faq/linux-unix-apache-increase-php-upload-limit/
Honestly, I've never tried this, but it appears to be what you need.
Edit:
Here's something else I found, you can try: ini_set("upload_max_filesize", "xM"); where x is a number and the M signifies Megabytes. I'm not sure if it works with all versions, but it's listed as being editable on the php website (http://www.php.net/manual/en/ini.list.php).

Categories