I have a file around 1-50 MB. I want to upload it to my server (website). In my website I don't need to log in, all I have to do is send $_POST informations directly to the main page for the file to begin uploading.

  1. POST
  2. PUT
  3. FTP

What is the fastest way to upload that file? I'm talking about the connect and upload time, not the time needed to fill informations. Using FTP, the time needed to connect to the host is included.

I've read that using the post method, the file is first uploaded to a temp directory before being copied to a permanent location (which is not considered as upload time).

  • 1
    The ability to upload a file via simple POST to your homepage makes me feel sad inside. Dec 24 '14 at 1:18
  • @Thebluefish Why? do you think it's malicious?
    – SkYWAGz
    Dec 24 '14 at 1:20

All three of those methods send the file in a plain TCP stream, so the actual transferring of the file data could be exactly the same in all three methods, assuming your HTTP software and FTP software are well-written to make efficient use of TCP.

Even if we assume perfectly efficient software implementations, the FTP method would probably have a little extra initial latency as it requires establishing a control connection, setting up the file transfer (a few quick, small packet round-trips), and then establishing the data connection.

Overall this is probably going to come down to how well-implemented your HTTP or FTP clients and servers are, and not differences in the relative overhead of the protocols.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.