Increasing your php max upload size

Started by Jason, July 28, 2006, 09:21:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jason

I've had a few questions on how to overcome the server's php settings -- most noteably in terms of the max upload (attachment) size.  Some people want to have their scripts (i.e. SMF) set to allow larger file uploads than the 2mb default established within php on the server.

If you have a legitimate reason for doing this, you can accomplish it through a php.ini file.  (Note, I wouldn't do this if you don't need it to avoid people uploading things you don't want and using your space.  I typically keep attachment uploading disabled by default).

Whereas the server has its defined variables for how php runs, with phpsuexec that we're running, you can upload a file called php.ini into whichever folder your script runs to override the server's default settings.  Whatever you put in there will override the server variables for that folder only.  In other words, if you need to have that setting in different folders, you would need to upload a copy of php.ini into *each* folder where you want that setting altered. 

In the case of the max upload size, the variable for that is:

upload_max_filesize = 10M

(where in this case, we're changing the 2mb to 10).

You would include that line in a txt file called php.ini and upload it to your account.


Mark

Quote from: Jason on July 28, 2006, 09:21:19 AM(Note, I wouldn't do this if you don't need it to avoid people uploading things you don't want and using your space.  I typically keep attachment uploading disabled by default).

I'd like to second this, unless you absolutely have the need for a bigger file size, don't change it. IMO, the only attachments that should be allowed are images and maybe PDF's if your website deals with text documents. And with that, a max of 300kb - 500kb is plenty. Just my 2 cents though. :)

Jason

Quote from: Killer Possum on July 28, 2006, 10:55:25 AM
Quote from: Jason on July 28, 2006, 09:21:19 AM(Note, I wouldn't do this if you don't need it to avoid people uploading things you don't want and using your space.  I typically keep attachment uploading disabled by default).

I'd like to second this, unless you absolutely have the need for a bigger file size, don't change it. IMO, the only attachments that should be allowed are images and maybe PDF's if your website deals with text documents. And with that, a max of 300kb - 500kb is plenty. Just my 2 cents though. :)

As a second followup, I would also disable hotlinking if you do go this route.  At the least, you'd make it a little more annoying for people who link back to files you're hosting (which uses your bandwidth).