Large file size with forms? - php

I'm using codeigniter, but what I've done is made a small upload form. When I try to upload a 49kb file it works, when I try to upload a 14mb file, not only does it not work, but it seems to be refusing to see it as a post. $this->input->post() is returning false. That is before all the CI code that checks upload size etc. So I don't understand what can be keeping the file from being uploaded all the way.

PHP has file size restrictions, default usually at 10MB. If you have access to php.ini, edit upload_max_filesize and post_max_size.
You can typically also accomplish this by adding the following to your .htaccess file, if you're on Apache:
php_value upload_max_filesize 100M
php_value post_max_size 100M
Other flags that might affect your success are max_execution_time, max_input_time and memory_limit.

Related

How to change max upload size for files in Wordpress 4.4 at xampp

I wanted to upload a template to wordpress 4.4 which is running on xampp but it says that I only can upload 2MB. I've googled the problem and found an information that i need to change the parameter upload_max_filesize=32M in the file php.ini. I doesn't found the file in the Wordpress folder but in the xampp folder I found a file called php.ini with the parameter in it and I changed the parameter but nothing happened.
What can I do to increase the max template upload space?
Have you tried this already? http://www.wpbeginner.com/wp-tutorials/how-to-increase-the-maximum-file-upload-size-in-wordpress/ It contains plenty of ways to increase the max upload size.
Make sure you increase post_max_size and upload_max_filesize, both limits.
So for example in PHP.ini:
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
Cause it may take longer to upload those files, you might want to increase max_execution_time as well.
post_max_size is the maximum size for all POST body data. upload_max_filesize is a maximum size only for files that are POSTed. Other types of POST body data are not subject to this limit. See Brad's answer over here: PHP post_max_size vs upload_max_filesize, what is the difference?

Increasing Upload_Max_Filesize limit

I am facing a little problem with increasing the Upload_Max_Filesize limit on a clients server. The Upload_Max_Filesize is set to 2M and I need to increase it to at least 10M. There's no php.ini file currently present inside any of the folders albeit I tried creating a php.ini file and then uploaded it to the root folder of the website but that didn't work. I also edited the .htaccess file by putting these two lines inside it but, sadly, that didn't work either:
php_value upload_max_filesize 10M
php_value post_max_size 10M
I have access to the cPanel but it's mentioned inside the PHP Configuration page that:
These PHP configuration settings are customizable by the server administrator. They are listed for reference only.
Please let me know if there's any other way through which I can increase the limit of Upload_Max_Filesize.
You have to contact your host to increase your upload size. I've successfully done it from 5mb to 20mb. You just need to ask.

Large file uploads failing php

I've made a tiny site where my friends can upload songs and some tiny files that they want to but my problem is that files over 5mb fails, as in the browser shows "Connection reset" error.
The max file size set by my server is 2Mb, but i can upload 2.5-3Mb fine
Probably because i overwrote it with .htaccess
But however file uploads over 5Mb they just don't get uploaded at all, as i said earlier browser cannot reach server.
Would this be a server issue? Or an issue in my code? Will i need to change things in order for large uploads to happen?
Also max post size and max file size is set to 40mb in the .htaccess file
Here is the website
http://sharebay.webatu.com/
You can try uploading some files over 7mb, mp3/flac/aac/m4a/wav/
Add these to .htaccess as well (adjust 10M to size in MB that you want):
php_value upload_max_filesize 10M
php_value post_max_size 10M
This assumes you don't have access to php.ini (otherwise it would be better to put there) and that your host does not prohibit htaccess overrides on these values.
If you've already tried that then post more info about your environment. If you are on a shared server it's probably not something you can change too much.
How long the upload takes?
If you have slow upload line then it should take more time then max_execution_time and then apache halts your PHP script.
Change file upload size
You can change it an .htaccess file.
.htaccess files are stored in the same directory as your .php files are. They modify configuration for that folder and all sub-folders. You simply use them by creating an .htaccess file in the directory of your choice (or modify it if present).
The following should enable you to increase your upload limit (if the server provider allows PHP config changes via .htaccess).
php_value upload_max_filesize 70M
php_value post_max_size 80M
php_value memory_limit 90M
php_value max_execution_time 240
php_value max_input_time 240
you can change size according ur need

How to increase my upload limit in php

I read so many articles out there in the internet and found that to change the php.ini file to upgrade the upload limit. But I do all the suffs and cant upload more than 10mb of files or so.
I am trying to add a feature to upload video file through the front end for users. But failed for some reason
Is there any other way to do it. Or is it because it is a video file or some thing like that
Make sure that you have (in php.ini, .htaccess, etc.):
increased post_max_size to at least twice the max file size that you might need to upload
increased upload_max_filesize to the max file size that you might want to upload
increased memory_limit to something bigger than post_max_size
On top of setting php.ini
upload_max_filesize = 200M
post_max_size = 200M
I owuld look into a flash uploader like uploadify. It will make your life much easier trust me.
Since you are changing the php.ini, are you restarting the webserver so that the changes take effect (if using mod_php)? Does the webserver itself have any restrictions set?
It's been a while since I've done this, but in my php.ini I have upload_max_filesize = 200M and I have post_max_size = 200M
I also set max_execution_time = 3000 If this is set too low, it'll cut off while the user is still uploading.
You should also bump up max_input_time and memory_limit

how to dynamically change the max upload file limit in php?

I want to change the max upload file limit dynamically. means by not changing the php.ini file on server.
Whenever user had uploaded more then 2 mb then my upload limit should be change.
I want to do all this through php.
Thanks in advance.
The limits enforces by upload_max_filesize are enforced before the php script is run, so the setting cannot be changed dynamically with ini_set.
For more information on the file upload ini settings and where they can be changed, see:
- http://php.net/manual/en/ini.core.php#ini.sect.file-uploads
- http://php.net/manual/en/configuration.changes.modes.php
Assuming by "user" you mean a visitor to your site, there are really only two methods you can enforce such a limit without the file reaching its final destination:
1) Before the upload has occurred: On the client side. You could definitely do this using a java-based uploader. Whether you can get the filesize of the selected file using javascript, I don't know.
2) After the file is uploaded to the server, but before you move it to the final destination (before you run move_uploaded_file)
Try this:
ini_set('upload_max_filesize', your_value_here);
Make sure also that you have specified the correct acceptable settings for:
file_uploads
upload_max_filesize
max_input_time
memory_limit
max_execution_time
post_max_size
If you can't modify your php.ini, you might be able to do it with a .htaccess file:
php_value upload_max_filesize 50M
php_value post_max_size 50M

Categories