Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML HTML Basics

Link:Left Mouseclick to SAVE File (txt) ?? Possible Task?

Discussing Html . Code , Software , other

Moderators: macek, egami, gesf

Link:Left Mouseclick to SAVE File (txt) ?? Possible Task?

Postby Franktheman » Thu Jun 03, 2004 12:00 pm

Hi,
a "little" Problem ..
I have a link to a *.LST - File.
This File is nothing else then a *.txt-File only with the extension changed.

I want the user to download this File with a LEFT mousecklick on the IE!
Is this in any way possible ?
I dont want to rename or pack the File.
When you click on the link now, the IE opens the file in the current window. (even though the windows explorer wouldnt know with which program this file has to be opened)

The other "little" Problem...
when you use the "save as" option (right mouseclick), the file would, as default, be saved as a *.txt file...
Now the file saved on the disk would be sth. like "whatever.lst.txt"
Thats NOT what I want.
Better would be, as default, save as "ALL FILES".. then the file would be saved correctly on disk ("whatever.lst")
possible ?

sounds complicated..

thanks 4 your help and answers
frank
Franktheman
New php-forum User
New php-forum User
 
Posts: 25
Joined: Sat Nov 08, 2003 8:15 am
Location: germany

1st small solution

Postby Franktheman » Thu Jun 03, 2004 2:01 pm

hi,
I was doing some more researches..

and found some php codes using the "header" function.., I didnt get them to work within my project..

by incident I found an interessting solution..
if I declare the filetype "LST" in windows
("always open with.." ->NOTEPAD) then the IE gives me excactly the save-option I want !!

the php "csv2lst converter" I build is only used by one pc, so I dont have the problem that millions of users need to configure their pcs.

although, I think the header-solution is probably the more interessting one..
hmm...
Franktheman
New php-forum User
New php-forum User
 
Posts: 25
Joined: Sat Nov 08, 2003 8:15 am
Location: germany

Postby ruturajv » Thu Jun 03, 2004 8:00 pm

do this...

on the left click , take the user to a page.. and on that page.

Code: Select all
header("Content-Disposition: attachment; filename=/path/to/file");
User avatar
ruturajv
php-forum Super User
php-forum Super User
 
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India


Return to HTML Basics

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.