Solved

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

Posted on 2000-04-13
8
4,286 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
 
LVL 16

Expert Comment

by:maneshr
ID: 2726779
cool!! Wish you all the best :-)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now