April 6th, 2012, 01:09 PM
Right-Click -> Save-As causing corrupt(?) file
[editing to clarify]
I am generating a csv file with PHP with a .txt extension on a CentOS server.
If I FTP this file down using either ASCII or Binary mode, it works fine. If I right-click and Save As from my browser (happens in IE and Firefox), it blows up my merge document (Word 2007).
The good file and the bad one are exactly the same size. I've done a byte by byte value comparison and the files are identical. To make the bad file good, all I have to do is open it in GVim and save it. Saving it in Notepad does not make it good.
I'm baffled as to what is wrong with this file when downloading through the browser that is not wrong when using FTP. It does not appear to be an end-of-lines problem as I have tried a number of combinations.
April 7th, 2012, 12:03 AM
Do the two files have an identical md5 checksum?
April 9th, 2012, 09:56 AM
The md5 checksums are identical in both text and binary mode.
Originally Posted by E-Oreo
Inspection with od says the files are identical.
Diff says the files are identical.
A C program that does a byte by byte inspection says the files are identical.
I'm at a loss as to what's going on.
April 9th, 2012, 10:44 AM
I found the problem. Windows was helping me. They're very helpful.
It noticed that the file "came from another computer" and silently blocked it to "protect" me. To make the file not blow things up, I had to go to it's properties and click the Unblock button.
Since the metadata is stored outside the file, the files themselves were identical.
Thanks for your help!