Solved

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

Posted on 2000-04-13
8
4,325 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

786 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