Forum Moderators: coopster

Message Too Old, No Replies

HTTP vs. FTP upload

what's the better solution to handle huge file uploads?

         

lars stecken

2:34 pm on Apr 21, 2004 (gmt 0)

10+ Year Member



Hi all,

I have to implement a file upload for a client who's customers should be able to upload very large files (up to 500 MB).

Up to now I always used the regular http upload, but also always experienced some problems with uploading big files (time outs, max_file_size, httpd.conf parameters etc.)

Since I want to make the upload as reliable as possible (and to avoid to make the customers having to start the upload over and over), I am wondering if ftp upload would be a better choice and if it would be more reliable than http.

I appreciate any advice or experience anybody can offer.

Greets Lars

ergophobe

3:15 pm on Apr 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



As I understand....

http was designed to be fast, but not solid. Who cares if you lose a few packets here and there anyway?

ftp does a lot more packet verification. That means it's somewhat slower for a given size file, but the file is more likely to get through in one piece because, for a binary application file, for example, one lost packet is as good as losing the whole thing.

lars stecken

3:42 pm on Apr 21, 2004 (gmt 0)

10+ Year Member



Thanks for your reply.

The files that should be uploaded will all be of the binary type, so from that angle I should root for ftp. But what about time out problems? Have you got any experience, concerning server load?

bcolflesh

3:48 pm on Apr 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Setup a real FTP server and use the FTP commands built into PHP:

[php.net...]

Or a third party web app, like:

[freshmeat.net...]

lars stecken

4:51 pm on Apr 21, 2004 (gmt 0)

10+ Year Member



Well, the question isn't really how to implement it - the PHP-FTP functitions are straight forward enough and also PEAR offers a solution with net_ftp.

Also, I do not need a php based ftp-client - the only thing the user is allowed to do is upload nothing else.

The question is if there's a general preference between http and ftp when uploading extremly huge files. ergophobe already hinted in one direction. Now I would like to know if there are any other pitfalls to look out for....

Thanks again

ergophobe

5:39 pm on Apr 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Well, the names tell you something: Hypertext Transfer Protocol is optimized for hypertext and File Transfer Protocol is optimized for files.

FTP Pitfalls:

- one more protocol
- might be slower on small files (extra roundtrip to open TCP connection; authentication used even for anonymous download)
- might be harder if user is going through a firewall.

FTP Advantages:
- more reliable in terms of data corruption
- might be faster (better packet recovery)
- resumable (I would think that would be a big one if transfers are getting dropped). Apparently some http requests are resumable too, but I don't know about that.

begion

1:23 pm on May 27, 2004 (gmt 0)



I don't understand what there is to gain from using FTP commands built in php or a ftp-webapp. The file still has to be uploaded from the client using HTTP. Or am I getting it all wrong?

I'd like my web-visitors to upload large files to the server, without the file being trasfered via HTTP first. Is this possible? How?

lars stecken

1:50 pm on May 27, 2004 (gmt 0)

10+ Year Member



I know what you mean - my thinking was completely screwed up. But one possibility that I tried and might work in a few situation is to establish an ftp-connection by URL (ftp://user:pwd@domain.ext/directory) and use the Windows drag'n drop functionality (drag the file into the IE window).
Problems:
- you have to create either one ftp-user for each uploader or a generic user.
- in either way you must limit the permissions to 'write' only
- you don't know the file name of the currently uploaded file and you don't know when the upload is fnished

Advantages:
- the well known progress problem is take care of by windows
- easy to user for your visitor

Greets,
Lars