Uploading HUGE files from a web browser???

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Uploading HUGE files from a web browser???

Post by Mr. Tech »

I know how to upload files from a web browser but when I upload really large file(In MB)? It seems to timeout or something... Can anyone help?
iamwho
Forum Newbie
Posts: 2
Joined: Thu Aug 14, 2003 5:07 am
Location: China

Post by iamwho »

set max_execution_time(default:30s) longer in php.ini
Galahad
Forum Contributor
Posts: 111
Joined: Fri Jun 14, 2002 5:50 pm

Post by Galahad »

I actually found that increasing the timeout value didn't make any difference. I don't believe that the php script starts running until after the file has been Completely uploaded (apache handles it). That's what my tests lead me to believe though, anyone know more of what's going on behind the scenes? We have a server running with a timeout of 30 seconds, but we can upload files that are several hundred megabytes.

I may have forgotten something, but here's what I remember changing:
(These files are where they are located in redhat running apache, I assume other platforms have similar files)
1. /etc/php.ini has a line "upload_max_filesize = 2M". Change it to whatever size you want.
2. /etc/httpd/conf.d/php.conf has a line "LimitRequestBody 524288". Since the file is sent to the browser as part of the request body, you need to change this value. Note that this is in bytes (1024 bytes to the kilobyte, 1024 kilobytes to the megabyte, etc). So if you want a 8 megabyte limit, you need to set this to 8 * 1024 * 1024 or 8388608. I'm not sure why this defaults to 512k since the php.ini max size defaults to 2M.

Anyway, I had much better success changing those values than I did with the timeout. Try them out.
Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Post by Mr. Tech »

Thanks!

But what if I can't edit the php.ini file? :(
User avatar
mikusan
Forum Contributor
Posts: 247
Joined: Thu May 01, 2003 1:48 pm

Post by mikusan »

You make a .htaccess file with the following:
php_value max_post_size 50M
php_value max_input_time 100000
php_value max_execution_time 100000
php_value upload_max_filesize 50M

You can set any PHP values like this...there are also ways to set it through your scripts but i dunno
Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Post by Mr. Tech »

thanks man! I'll try it!
Post Reply