59051

What are the caveats with increasing max_post_size and upload_max_filesize?

Question:

I want to increase max_post_size and upload_max_filesize on my server so that my application will handle larger files (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.

Answer1:

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.

Answer2:

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.

Answer3:

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 <em>Nathan</em> 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.

Recommend

  • Python: ascii codec can't encode en-dash
  • Stacked 3d bar chart with matplotlib
  • Struct vs test double in ruby
  • Java 8, why not a ZonedTime class?
  • Need help adding not responding check to batch file
  • MouseScroll event does not trigger when TextBox is scrollable
  • Extending a return object with keys matching a dynamic child
  • Get Network Interface Names and Set All to DHCP Batch Script
  • Eloquent Javascript: Can't understand how the number value is determined in the sum function
  • How to order the ties in data so that the previously observed value appears first
  • What is the reason for using single-character generic type names in java?
  • NodeJS - installing local module
  • NoSuchMethodError javax.ws.rs.core.Application.getProperties()Ljava/util/Map
  • What is need of Assign/Deassign in Verilog?
  • CSV processing in Hadoop
  • configure openjpa on to spring boot
  • How to wrap a JMS to WebSphere MQ bridge in a synchronous call using the request-reply pattern?
  • Complex multiple if statements
  • Unable to connect to Azure MySQL Database through Azure Function - C#
  • How to run Daphne Server (Django Channels) & workers in the background?
  • Adding Dynamic Row and Data on Checkbox Click
  • Find corners of a rotated rectangle
  • GTK3 + OpenGL for windows: multiple GtkGLArea (ie. OpenGL contexts)
  • How to display content depending on dropdown menue user selection
  • Regex not working in java 1.5
  • How to create subsets of a single set of elements with XSLT?
  • Ruby regex for matching simpliest Ruby's regexes
  • Conflicting declaration using constexpr and auto in C++11
  • Cloud Code: Creating a Parse.File from URL
  • Android: Unable to detect vertical plane
  • How to integrate angular2-material (alpha 8.2) with angular2-Quickstart app
  • php “page caching” solution suggestions for CMS Applications
  • Excel VBA : conditional formatting of sheet1 cells from sheet2 values in excel 2007
  • Codeigniniter insert data through models and controller
  • Jersey serializes character value to ASCII equivalent numeric string
  • CAS 4 - Not able to retrieve the LDAP groups after successful authentication
  • What does the “id” field in an Android “Google Play Music” broadcast intent correspond to?