PHP: Having trouble uploading large files - php

I am doing a file upload using PHP, which works fine for a file of size 2.8MB on my localhost - but not my Mediatemple GS host. Files smaller than 2MB work fine, but anything larger seems to not work... I am not getting any error message but when the upload finishes, the file is not found in the uploads directory...
I googled around, and I added the following lines to the .htaccess file:
php_value memory_limit 120M
php_value max_execution_time 120
php_value upload_max_filesize 10G
php_value post_max_size 10G
I know some of the above values are a overkill, but even then, this does not seem to help... Anything else I might be missing?

The one you missed is max_input_time, and do check whether your edits are reflected in phpinfo();.

Check the phpinfo() and look for these four values - it's possible that the changes you think you're making haven't been applied, or that something else is overriding your changes. The values you've changed look correct to me.

Related

Max File Size php server

I am using wamp as my test server and when trying to upload videos I am getting an error code 1 which is an error saying that my max file size is to small. I changed my php.ini settings to
; Maximum allowed size for uploaded files.
upload_max_filesize = 700000000000000000M
and i changed my htacess file to say this ..
RewriteEngine On
php_value post_max_size 1000000000000000000M
php_value upload_max_filesize 1000000000000000000M
php_value max_execution_time 60000000000000
So there is plenty of room I don't understand why i still get this error .. Thanks in advance for the help.
Were you sure that you restarted Apache after you edited the php.ini file?
Apache loads the php.ini on start so if you made changes without restarting Apache the changes will not take effect.

Increasing the Upload Limit of my PHP script

I have a simple PHP script. Its used to upload users into the joomla tables. Basically it uploads users into joomla three main tables.
The PHP uploader sript works fine when the CSV is about 80MB to 100 MB.
It does not work or just nothing happens when the file size is 500MB or above.
How do i make the PHP script work to upload the CSV files of over 500 MB?
Do i actually change something in my PHP.ini settings or is there something else i could
add in the script itself.
Thanks in Advance.
in the .htcaccess file add the following:
php_value upload_max_filesize 500M
php_value post_max_size 500M
in php.ini add:
upload_max_filesize = 500M
post_max_size = 500M
You have to change the upload_max_filesize in php.ini
I had the same issue long time ago with rails and mysql,
You have to consider 3 things when you want to upload a file:
Max upload file in PHP
Be sure that MySQL will save a big file.
Your browser will lost connection after a while uploading a file to your database if it don't receive any answer from the server.
I think that You handled the first 2, but to handle the 3rd probably you will need a upload progress bar to keep the session active. Actually you need some AJAX to keep the server and the client "talking" meanwhile the file still uploading.

Getting trouble while uploading a file in PHP

I'm using PHP as server side programming,I'm facing a different type of problem while uploading the images.If the uploading image is having below 8MB is uploading fine but if image size is increases then its not uploading.What might be the problem.I know I've to change in php.ini file,but where I don't know.please help me
Yes,you need to change a upload_max_filesize value to your desired value in php.ini file.After that you have to restart the server
You need to establish first where your PHP.ini is coming from. If you create a PHP script with this one line of code in it and access it in your browser, that will tell you:
phpinfo();
(Mine says: Loaded Configuration File /etc/php5/apache2/php.ini )
Then edit that file and alter the lines
post_max_size = 8M
upload_max_filesize = 8M
to something more appropriate. Then restart Apache. You may be able to use the .htaccess method in vlzvl's answer, but I'd say probably not.
open you .htaccess and write:
php_value upload_max_filesize 16M
php_value post_max_size 16M

Large file size with forms?

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.

Uploading files over 20MB via PHP to mySQL (GoDaddy Unix)

I am trying to modify existing PHP code, mySQL database and server settings (php.ini and .htaccess) at GoDaddy to allow for uploads in excess of 20MB (new limit will be 30M). Currently, when I upload anything larger than 8MB, the PHP code apparently executes (I know this because there is an update query that shows the result of the upload), no errors are reported from PHP, mySQL or the server, but nothing is uploaded either.
I have set the following parameters in the php.ini file:
memory_limit = 100M
post_max_size = 30M
file_uploads = On
upload_max_filesize = 30M
max_execution_time = 0
max_input_time = 0
my .htaccess file says
LimitRequestBody 0
My PHP code works well for files under 8 MB but I am having trouble figuring out why anything over that is not happening at all. I checked the file upload location (I physically upload the file to the server's filesystem before I insert/update the data into mySQL) and the files over 8MB never make it. So my guess is that this is where it fails.
Anyone have an idea what I am missing?
Thanks in advance for any input.
M
EDIT:
OK - feel free to award me the dufus badge! I am working in php5. The friggin php.ini file (at least on this server - don't know if this is true of other servers) only works for versions below 5. For version 5 you have to use php5.ini.
As per the GoDaddy support document: http://help.godaddy.com/article/1475
On MySQL side, there is max_allowed_packet variable that limits size of single request, e.g the size of SQL query. You can set it to 50MB or so in your case.
Use a phpinfo file to check for definite what the limits are. Just make a file with the following contents and call it whatever you like (with php extension...):
<?php phpinfo(); ?>
According to this post (http://wordpress.org/support/topic/upload_max_filesize-increase-on-godaddy) you need to add another line to your .htaccess:
suPHP_ConfigPath php.ini

Categories