c++ - How to download file with CGI -


i'l know code download file existing in c:/ directory using cgi (it may sounds weird, there such possibility file may exists in server in computer's c:/).

i know have use content-disposition, ways try, cgi fails download anything, creating empty file name format gave. among many ways tried make work, basic code:

cout << "content-type:image/png\r\n"; cout << "content-disposition: attachment; filename=teste.png\r\n\r\n"; 

for i'm using image data type, later i'l download specific package of data called .pac.

thanks help,

momergil

looks like, want upload file not download.

printing name of file in header not enouph. after printing header, open file , send content in raw-bytes mode, and... done.

you see popu pin client browser asking save file.

--

std::cout << "hello world" << std::endl; better : std::cout << "hello world" << "\r\n";

because "\r\n" isn't web standarized, , does'nt work expected under linux/android.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -