Forum Moderators: coopster

Message Too Old, No Replies

uploading 2MB+ pictures

         

Moosetick

9:01 pm on Jan 13, 2006 (gmt 0)

10+ Year Member



I have a site that has a picture album. It is hosted and I believe the php.ini file is set at the default of 2MB limit per file.

With 5MP+ cameras out there many people have pictures that are over 2MB straight off the camera. As a convenience to the user, I would like to let them upload the pictures immediately after they pull them from the camera. I have the pictures resized to around 50k once they are on the server to conserve space and bandwidth.

Unfortunately, I can't even get the files over 2MB onto the server. As you know, many people are clueless about resizing their pictures and won't go to the trouble. I want them to be able to use my site. Does anyone have any good tricks to move 2MB+ files?

StupidScript

10:31 pm on Jan 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your options depend on the type of server you are running. Here's a solution for an Apache server:

If it doesn't exist, make a new text file named

.htaccess
and place it in the directory your upload script is in.

The

.htaccess
file should contain:

php_value upload_max_filesize xM

where

x
is the maximum size you want to allow, in megabytes. (i.e.
5M
for 5MB).

The reason this variation from the .ini file is not placed in the script itself is that the .ini instructions have already been initialized by the time the script is opened, and the

[url=http://us2.php.net/manual/en/ini.core.php#ini.upload-max-filesize]upload_max_filesize[/url]
instruction would be ignored. Placing the instruction in the
.htaccess
file causes it to replace the .ini instruction *before* the script is parsed.

You may want to check that you are not violating your hosting company's TOS before making this kind of change.

I don't know what to do with other server brands ... never used 'em ...

Moosetick

4:38 pm on Jan 17, 2006 (gmt 0)

10+ Year Member



Thanks a lot! That did it.

Now my only problem is it still takes forever(2+ minutes) for those 2MB+ pics to load. I guess the only way to fix that is to have the users resize their pictures before they attempt to upload them. I limit it to 10 pictures at a time but if someone tries to upload 10 2.5MB pics, they may be waiting 30 minutes for it to happen.

I don't guess there is any type of clientside script that can resize the pictures before they are uploaded. If there are I'd be interested though.

Tom