Solved

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

Posted on 2000-04-13
8
4,380 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Stressed Out?

Watch some penguins on the livecam!

 
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

695 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