Re: Large/unreliable file uploading over HTTP
| From: | Michelle Konzack | Date: | Fri, 19 Sep 2008 20:32:19 +0000 |
| Subject: | Re: Large/unreliable file uploading over HTTP | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-280587@lists.php.net to get a copy of this message | ||
Hi Todd,
Am 2008-09-08 11:11:45, schrieb Boyd, Todd M.:
> I'd be more than happy to spread the source around. Files of any size
> are not a problem... the Applet breaks a file into (I believe) 512kb
> chunks for transfer. The first POST to PHP tells PHP how many chunks and
> some other identifying information. Each POST after that is a 512k chunk
> of the file. These files are then strung back together after the last
> chunk is uploaded.
Oops, this is what I do since 2 years, but using "php-cli" interface on
the CLIENT side...
> I probably need to do some hash checking to ensure that files have, in
> fact, uploaded (and uploaded completely)... but for testing on my local
> machine, I didn't bother (yet). The problem is that a few bytes
> (depending on the size of the file--and therefore, the number of chunks)
> are missing from the uploaded file. This makes MP3s sound like they were
> recorded underwater, and text files miss a letter every now and again.
I use:
exec("split --suffix-length=4 --numeric-suffixes --bytes=${SIZE} ${FILE} UPLOAD_0");
exec("md5sum UPLOAD_0* >UPLOAD_md5sums);
...
/* upload a file and receive a cookie */
exec("wget --save-cookies=UPLOAD_cookies --http-user=${user} --http-password=${password}
--post-file=UPLOAD_0${CHUNK} ${URL}");
/* use the cookie to get the status of the next file */
exec("wget --load-cookies=UPLOAD_cookies --http-user=${user} --http-password=${password}
${URL}");
...
Thanks, Greetings and nice Day/Evening
Michelle Konzack
Systemadministrator
24V Electronic Engineer
Tamay Dogan Network
Debian GNU/Linux Consultant
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
+49/177/9351947 50, rue de Soultz MSN LinuxMichi
+33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)