开发者

What are the caveats with increasing max_post_size and upload_max_filesize?

I want to increase max_post_size and upload_max_filesize on my server so that my application will handle larger fi开发者_JAVA百科les (as large as 2gb). But before I do that, what are the caveats? Obviously there was a reason the PHP developers set the size to be low. Will I need a certain amount of RAM for the operation? Any insight would be helpful.


One of the biggest issues I see, is that POSTS are a one shot deal. What I mean by that is that if your client is uploading a very large file, and a network interruption occurs when they are 90% finished, they will have to start from scratch.

I believe there are Flash and Java based solutions that will upload a file in chunks to be reconstructed on your server. I have only used one that was made for Amazon's S3 service called Jets3t, but hopefully someone else can recommend another.


The posted data is streamed into memory while it is being posted. Multiply the max post size by the number of users you expect to have posting the maximum at any point and that is the amount of memory you'll need to hold posted data across all sessions/processes.

Your upload max size must be less than max post size. The difference of max post size and upload file size is the amount of data left available for things like annotations or message content.

But really, making users able to post up to 2gb makes for an easy DOS attack. Even if you're limiting the availability of the app to corporate users on the local intranet, it wouldn't be hard for a disgruntled employee to cause you some headaches.

Of course you could just put a really large amount of RAM in the box on a 64-bit platform, but I suppose it depends on how much money you want to spend.


That's more a problem of security, let's imagine a bunch of hackers decide to attack your website and start uploading 1.99 giga files from many machines.

The disk of your server would be fill in no time and the server would pretty much slow down to be unusable.

For the memory problem that Nathan mentioned I think it is a myth, PHP does stock some in memory but drop it also on the disk at same time so the amount of memory should be pretty much ok.

You might want to give some kind of FTP access to your user, so in your application they would able to browse that ftp directory and import whatever selected file. The FTP allow append and kind of easy recovery in case the connection goes down.

Also have to be noted in terms of user experience uploading a 2 gb file on a browser is really bad, like your browser would freeze during minutes and you don't know if it stuck the progress, so using some Flash/Applet based solution or FTP where the user have some feedback is really better.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜