Solved

"Content-Type: application/x-unknown "  , different response in IE 4.0 & 5.0

Posted on 2000-04-13
8
4,340 Views
Last Modified: 2013-12-25
To make the browser ask "Save File to Disk" , I make "Content-Type: application/x-unknown " and download the file from the remote location successfully. This works perfectly fine in IE 5.0 and NN 4.0 onwards but in IE 4.0 , It displays the file to be downloaded instead of asking "Save File to Disk"

Help Please URGENT

Here is the full code
print "Content-Type: application/x-unknown\n";
print "Content-Disposition: attachment; filename=$file_name\n\n";
$output_file = read_file($target_file);
print $output_file;

## Sub read_file
sub read_file {
    local($fname) = @_;
    local($content);

    open(FILE, "<$fname") ||  print "cannot open ".$!;

    while(<FILE>)
    {
        $content .= $_;
    }
    close(FILE);

    return $content;

0
Comment
Question by:funkyshah
  • 5
  • 3
8 Comments
 
LVL 16

Expert Comment

by:maneshr
ID: 2716177
funkyshah,

                    i would suggest you try this.

                    i addition to sending an unknown header, try changing the extension of the file to xyz or something that you system will
                    not understand.

                    Eg if you send a file with .doc extension, IE will try to launch Word to open it since .doc is mapped to MS-Word in your
                    system registry.

                    Therefore if you send an unknown extension, and assuming that that extension is not mapped to any app on the system, it
                    should prompt the user with the save dialog box.

                    Hope that helps
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2723867
any luck on this so far??

0
 

Author Comment

by:funkyshah
ID: 2725281
Manesh ,

Nope , Frankly I haven't tried the last one that is to change the extension to something gibberish . I need couple of more days to clear that. I will get back to u on this very soon. Gimme 2 days.
0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
LVL 16

Expert Comment

by:maneshr
ID: 2726779
cool!! Wish you all the best :-)
0
 

Author Comment

by:funkyshah
ID: 2729640
Hi Manesh ,

It works perfectly fine except that when it asks the user 'Save File to Disk' appears with the .xxx extension. That is one reason why It is not accepted here in my office. Because the user might not notice the extension and might save it resulting in an unknown file in his local. So the problem still remains open and looks like there could'nt be any solution around the corner.
I am afraid I am not giving the points to you as I would like to keep the question open ........
Sorry !
0
 
LVL 16

Accepted Solution

by:
maneshr earned 50 total points
ID: 2730612
what you can tell the user is to run a small exe or batch file after downloading the file. this exe or batch file would ask the user for a new extension and rename the file.

Alternately you can append a .xxx to the complete file name itself.
EG. if filename is resume.doc you send it across as resume.doc.xxx.
0
 

Author Comment

by:funkyshah
ID: 2733300
Yup that's one way it could be done.
Although I am not doing it that way right now as it is meant for a site which gives free space to users to upload/dowmload files and want a simplest possible solution. The office guys do not want any hassles of asking the user to download a small exe to do that. Although it is a simple issue but then that's the way things work when u work for somebody else.

I am not sure whether I should give u the points.

I guess I'll give u .....
Thanks !
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2740413
i understand your predicament, especially since i was myself facing a similar situation when i was developing a very similar web site (www.diskonnet.com).

i suggest you enroll yourself at this site and see how it works. it basically uses ASP with PERL and a bit of javascript to provide a very handy functionality.

Who knows you might get some hints which will help you or at least guide you towards the solution.

Rgds
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question