RotoGuru Computer Forum

View the Forum Registry

XML Get RSS Feed for this thread


Self-edit this thread


0 Subject: Creating a 'Save As' icon

Posted by: Guru
- [330592710] Wed, Apr 26, 2006, 16:58

In a web page, I'd like to embed an image icon which, when (left-)clicked, would open up a "Save As" dialog box, prompting the user to specify a filename & location for a target file to be saved.

What's the best way to do this? It would need to work in all typical browsers.

JavaScript?

Php?

Can anyone provide an example?
1Guru
      ID: 330592710
      Wed, Apr 26, 2006, 17:00
I should add that when the icon is clicked to save the file, the page shown in the browser should remain undisturbed, so that when the save operation is complete, the original page is still active.
2Guru
      ID: 330592710
      Wed, Apr 26, 2006, 17:07
As further background, the target file will be an mp3 file, so creating a simple [a href=filename] link will simply load the mp3 file in the browser.

What I want to do is set up a process with a result similar to right-clicking on a filename. This is for a page of mp3 files that I want neophytes to easily download insteading of playing them in the browser.
3Guru
      ID: 330592710
      Wed, Apr 26, 2006, 18:10
I found this PHP approach which seems to work:
http://www.sitepoint.com/forums/showthread.php?t=156577
4Astade
      ID: 293552522
      Wed, Apr 26, 2006, 18:11
Guru,

I suggest Jscript.
In your tag add an onclick event using the execCommand control.

More information
6youngroman
      ID: 50818914
      Wed, Apr 26, 2006, 18:40
I think 4 will only work in IE and not in other browsers like Firefox, Opera or Safari.
7Astade
      ID: 293552522
      Wed, Apr 26, 2006, 19:51
I didn't read post #2.
My initial post only works for webpages really.
YR also brings up a good point that it is only supported in IE.

I looked at post #3.
That looks like a good bet. Server-side coding is the only way to do this. "Content-Disposition" is the key.
8Trip
      ID: 72553010
      Wed, Apr 26, 2006, 23:44
#6... That would probably take care of the problem as I would figure other users weren't neophytes.
9Guru
      ID: 330592710
      Thu, Apr 27, 2006, 12:27
Went with the PHP solution. I don't think you can assume that people using FireFox or Safari aren't neophytes. My Mom uses Safari, and she has no idea what she's doing - nor does she typically try something different if the first click doesn't produce the desired result. She'll often just give up and assume it doesn't work in her browser.
RotoGuru Computer Forum

View the Forum Registry

XML Get RSS Feed for this thread


Self-edit this thread




Post a reply to this message: (But first, how about checking out this sponsor?)

Name:
Email:
Message:
Click here to create and insert a link
Ignore line feeds? no (typical)   yes (for HTML table input)


Viewing statistics for this thread
Period# Views# Users
Last hour11
Last 24 hours11
Last 7 days32
Last 30 days98
Since Mar 1, 20071355557