Hi all,
i'm coding something similar to a 'http-server', and i'm having problems with sending files to the client (web browser) from the server. instead of the client getting a Save File download box, it just recieves all the assembly code from the file, it gets printed as html text to the html page instead of downloaded as a file.

I am wondering if there is a string or something that i have to send to the client that lets it know there's a file being sent before i actually send the file contents (bytes)? i've looked through several RFC manuals and i can't find anything related to it, i must of spent at least 2 full days looking for a anwser or some code on google that could help me.. any help would be appreciated, thanks.

Recommended Answers

All 6 Replies

What HTTP headers are you sending?

Content-Type & Content-Length

How about some sample output then.

I'm giving you the "I wash my hands" type of answer, namely a link to a tutorial but I hope it would prove to be useful, since it looks like covering all the important stuff. http://www.cpp-home.com/tutorial.php?26_1 is your link. On the other hand - why are you trying to send assembly code to a remote machine? I should either go to bed or it smells a bit like something else.. ;)

i just get machine code, but it's complete.. meaning i can copy all the code, put it notepad, and save it as the file i'm sending and i can open/view it.

I figured out my problem, there was an error in one of the http headers i was sending to the client, thanks to those that replied so quickly. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.