简体   繁体   中英

Best way to verify data upload integrity between PHP and Flash

I have written an uploader for massive files (tens of gigs) in AIR, which sends small chunks of the file at a time (<1 meg) to the server (collected via PHP).

It works very nicely 99% of the time.

However, there are rare instances where the collected file is corrupt. I have no way to account for this, but my thought is that if I verify each slice as it goes up, this will fix the problem, so, the question is... what's the best way to verify?

My impulse is to do an MD5, in PHP and send it back upon slice upload completion and then do an MD5 on the Flash side and compare.

Performance isn't *too huge a concern, but if there's a more efficient (and equally simple) way to handle this, I'd rather do it that way. Ultimately I have no desire to reinvent the wheel.

All suggestions welcome.

TIA

I went with MD5. Seems to work brilliantly.

The only thing I did differently than in my question was that I do the MD5 on the Flash side before I send it up and add that as a POST param. Then, on the PHP side I can do a comparison as soon as the file arrives, and if they are not the same, I send back an error to the Flash. It may be a "6 of one 1/2 dozen of the other" difference, but it does appear more elegant to me (not sure why).

Hope this helps someone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM