I recently got information on some other nodes about creating and storing files using CGI.
Now i have the trouble of trying to get the browser to download them. I have a number of files ready for download in different directories on the server. The one i am trying to download here is called $updated - an updated text file.
I understand that the browser was designed not to download the files automatically, but i want it to do something at least that can allow for downloading from a server location.
My questions are: 1. I have tried to use the code from File Download from CGI Script but it doesnt work. I have the following :
but none of it works. It merely diplays the text on the screen, as described in the node above.print("<BR>DOWNLOAD ATTEMPT 0<BR>"); print ("Content-Type:application/x-download\n"); print ("Content-Disposition:attachment;filename=$updated\n\n"); print("<BR>DOWNLOAD ATTEMPT 1<BR>"); print $html->header(-type => 'application/octet-stream', -Content_Disposition => "attachment", -filename => $updated); print("<BR>DOWNLOAD ATTEMPT 3<BR>"); print $html->header(-type => 'application/octet-stream', -Content_Disposition => "attachment", -filename => $updated); print("<BR>DOWNLOAD ATTEMPT 4<BR>"); print ('<BR><a href="file.txt"></a><BR>'); ## added late print("<BR>DOWNLOAD ATTEMPT 5<BR>"); print ("Content-Disposition:attachment;filename=$updated<BR>"); print ("Content-type: application/octet-stream<BR><BR>"); print("<BR>DOWNLOAD ATTEMPT 6<BR>"); print('<a href="$updated?downloadid=1">download the txt file</a>');
2. If the files were downloaded where do they go if no directory is specified. With some of the code above i found that you could get the browser in theoru to display a save as box (not done working here).
MonkPaul.
Janitored by holli - fixed link
In reply to Download File using CGI by MonkPaul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |