Knowledgebase

PHP: Large file uploads

Posted by Khao8, 07-01-2009, 01:11 PM
Hey all, I've been trying to allow my PHP to handle large file uploads and I can't seem to make it work. The thing is I want the larger limit to be only on one file (admin.php) because for other uploads made by normal users the default size limit is ok. I've added php_value directives to my apache configuration inside a tag and it didn't work, so I added those lines to my admin.php : It still doesn't work. I don't receive any error message so it's really hard to figure out what's wrong with what I am doing. Uploading files under 2MB works fine and over that, it won't work. I'm on a dedicated server too so I should be able to override those settings easily.. Anybody can help me? Thanks

Posted by serversignature, 07-01-2009, 01:58 PM
Change the setting using php.ini file. All the configuration settings for your php installation are contained in the php.ini file. You can call the phpinfo() function to find the location of your php.ini file, it will also tell you the current values.

Posted by jstanden, 07-01-2009, 02:11 PM
If you prefix ini_set() with '@' then you'll suppress any errors and not see them anyway. If your PHP is running with safe_mode=On then you won't be able to overload the php.ini using ini_set(). As mentioned above, your best bet is to increase the values in the php.ini file and then restart Apache.

Posted by Nich, 07-01-2009, 07:13 PM
You might not be able to override those settings directly at runtime. The best bet is to modify those settings in your php.ini (and don't forget to restart your web server!)

Posted by 01globalnet, 07-01-2009, 07:59 PM
The 2 first settings must be changed server wide or per directory from your host - you cannot override these settings in your account with an .htaccess, php.ini or ini_set.

Posted by JBapt, 07-03-2009, 09:46 AM
for large file uploads use the ftp class in php. Otherwise it will never work properly.

Posted by ramnet, 07-03-2009, 07:52 PM
You won't get any errors with @ prepended since having @ prepended is like setting error_reporting(0); for that function call. Remove the @ from the function call and the errors should appear.

Posted by xphoid, 07-04-2009, 05:46 AM
You can override upload_max_size and post_max_size via htaccess. The reason why it probably isn't working is because the file upload happens before the script is called. Set it outside the script (htaccess or php.ini), and it should work fine.



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
DirectAdmin resellers (Views: 570)
is AVG still alive (Views: 595)


Language:

Client Login

Email

Password

Remember Me

Search