Facing issues with Content-Type:application/x-download Content-Disposition:attachment

I am in the process of developing a perl cgi page.
I had succeeded in developing the page but there are few errors/issues with the page.

description about cgi page:

My CGI page retrieves all the file names from an directory and displays the files in drop down menu for downloading the required file.
Error 1:

Content-Type:application/x-download Content-Disposition:attachment;filename= 
is displayed on the screen

Error 2:

I am able to display the dropdown box and my drop down doesnt contain anything. It failed to retreive the files from the directory.
But if I make the seperate code for this.... it worked.
     If placed in my cgi program  not able to get the files.

I have attached the screenshots of the web page.
And also attaching the complete code.

Could you please let me know how to come out of this issues.

Tons of thanks....!!!

Regards,
Giridhar

I think you ended your header too soon with "\n\n". Perhaps you meant "\r\n", so later when you term the http header, use "\r\n\r\n".

Thanks DGPickett ...

I tried with the change that you had suggested but no luck .....

and

Content-Type:application/x-download Content-Disposition:attachment;filename=

was printed directly on the webpage.

Could you please let me know what went wrong ....

Can you try checking the value of $ID before using it.

1 Like

thanks shreedhar....

I had placed few excel files in a folder and trying to catching the files in select tag in cgi perl.

But I am not able to capture the files in select-options dynamically.
files are stored in array. If I print the array( @files : files are stored into this array ) all the file names are displayed on the webpage.

not sure what went wrong.. trying to solve this issue since 5 days but no luck..

i ask you to check below few things:

"C:\\Program Files\\Apache Software Foundation\\Apache2.2\\reports\\";
"c:/Program Files/Apache Software Foundation/Apache2.2/Reports/";

  • check the // \ in the above path names.

open(DLFILE, "<$files_location/$ID") || Error('open', 'file');
@fileholder = <DLFILE>;

*Check the above line once wat is the acutal o/p?