From: Roland Schmitt Date: 2005-01-07T01:24:36+09:00 Subject: Re: Image decompression, eruby Hi, Belorion schrieb: >>I don't have any idea about dbi or mysql... >> >>Attacking the problem by the web side :), maybe the upload got interrupted >>and you are getting a truncated file. >> >>If you add a parameter like >> >> >> >>at the end of your form, you can check it to know if all the previous fields >>arrived whole. At least, if that's not the problem, you'll have a variable >>less to ponder (and it is a good general tip, too :). >> >> > > > I just tried dumping fromfile.read to a file and then viewing the > file. It turns out that the data at that point in time is *fine*. > So I know the data is arriving whole. So, it has something to do > specifically with inserting the binary data into MySQL, which I > suppose is beyond the normal scope of this list (though I won't > discourage any more suggestions!) I am going to do some digging on > binary data in MySQL, but if anyone has any more suggestions I'd love > to hear them. > you can try to convert the binary data to base64 and then store the base64-data in the database: require "base64" ... b64_data = Base64.encode64(binary_data) # store to db ... # read from db binary_data = Base64.decode64(b64_data) ... Obviously you must convert back after reading the data from the database ;-) For me base64-formatted data is easier to handle when looking for differences between two files. Regards, Roland