Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

i am making an application which has a function that it encrypt file and then upload it to the server via HTTP POST. I tried it and it works fine when i test it on localhost (Local Server on my same machine).

However now when i try it with a url of a public server with same server side php code, files are uploaded but they are corrupted.

However if the file is not encrypted even if it is binary data, it works fine. Can you tell me what could be the problem, or is it the server does not allow encrypted files?

I am confused because for the server, it should be just another binary data file, then why does it only get corrupted when it is encrypted, while otherwise it works fine. Or may be it is free hosting, that is the reason?

share|improve this question
    
How do you determine if the file is corrupted? –  Oliver Salzburg Jan 29 '12 at 22:25
    
@OliverSalzburg, by trying to decrepit it. It is simple AES-256 encryption done by 7zip command line tool, and the same tool (or any other winrar e.g) can decrypt those files easily. I tested them on two different machine on my PC's (WAMP server), and it is fine, but when i upload them over internet on this free hosting, i can not decrepit the files, which is not understandable for me? –  Johnydep Jan 29 '12 at 22:33
    
OK, so i just uploaded the file to their server via ftp (without using my code but via their web cpanel) and now when i download it back, it is corrupted, so i am pretty sure the problem is with their file system or something like that. But it is strange –  Johnydep Jan 29 '12 at 22:35
1  
@OliverSalzburg OK I got it. I was uploading correctly, but i was downloading in ASCII mode, and being encrypted it was not working. I just downloaded the same file uploaded from my code, in binary mode, and it is valid archive... –  Johnydep Jan 29 '12 at 22:54
1  
Great! Remember, you can answer your own question. –  Oliver Salzburg Jan 29 '12 at 22:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.