What html element can I use for "download/save file as" box?

T

thisis

Hi All,

I have an asp/html page that opens a "download/save file as" box,
- e.g. like the element for uploading files <input type="file" .../>


My Question is:

What html element can I use for "download/save file as" box,
Or what alternatives do I have for displaying this operation -
download/save file as" ?
 
A

Andy Dingley

thisis said:
I have an asp/html page that opens a "download/save file as" box,

It doesn't. What it does is it offers a link to some content (with <a
href="foo" > ) and _that_content_ causes the "save as" dialog to
appear, for some population of users. In particular the HTTP
content-type header that's supplied with this content will trigger it.

You can't control this triggering. It's usually not a response _to_
something definite, but a response when that thing isn't recognised.
Some browsers will now display XML, some (older) browsers won't
recognise it and so they fall back to a default of offering to save it
for you. Much depends on the particular config of particular browsers
for particular users. HTML is always going to be displayed. ZIP files
will be saved. XML could go either way, and you can't predict this.

You can _suggest_ the display / save switch. A well-admined server will
already do this, or you can control it yourself through ASP. They
recognise the file extension and select an apropriate content-type
automatically. Sending "recognised and displayable" content-types
causes display, Sending "known but undisplayable" types causes a save,
as does "unknown" -- in most cases. Remember that this is the
_browser's_ list, and you don't know it exactly.

If you want to "recommend" saving rather than display, then send a
content-type that's likely to do this for most browsers. As you don't
say what your content is, then it's hard to recommend one (although
application/octet-stream might do the trick).

For a simple "quick hack", then just zip the file up and link to the
zipfile.
 
T

thisis

Andy said:
It doesn't. What it does is it offers a link to some content (with <a
href="foo" > ) and _that_content_ causes the "save as" dialog to
appear, for some population of users. In particular the HTTP
content-type header that's supplied with this content will trigger it.

You can't control this triggering. It's usually not a response _to_
something definite, but a response when that thing isn't recognised.
Some browsers will now display XML, some (older) browsers won't
recognise it and so they fall back to a default of offering to save it
for you. Much depends on the particular config of particular browsers
for particular users. HTML is always going to be displayed. ZIP files
will be saved. XML could go either way, and you can't predict this.

You can _suggest_ the display / save switch. A well-admined server will
already do this, or you can control it yourself through ASP. They
recognise the file extension and select an apropriate content-type
automatically. Sending "recognised and displayable" content-types
causes display, Sending "known but undisplayable" types causes a save,
as does "unknown" -- in most cases. Remember that this is the
_browser's_ list, and you don't know it exactly.

If you want to "recommend" saving rather than display, then send a
content-type that's likely to do this for most browsers. As you don't
say what your content is, then it's hard to recommend one (although
application/octet-stream might do the trick).

For a simple "quick hack", then just zip the file up and link to the
zipfile.

Hi Andy Dingley,

Thanks for the detailed guidelines.

my content type are image file types: .bmp,.jpeg,.jpg,.gif - animated
too, partially .wmf

i use ms-internet explorer 6.0, on some web sites. when an image file
is displayed on it,
sometimes a "4 options small bar" - save file, print file, email file,
open my doc's folder - is displayed on the upper left side. sometimes,
a resize image thumb is displayed on the image. the reason is for
posting this topic is, because not all clients use ie,
so i want to have a more clear controled switch on my web page.

Maybe you have a sample code page for your example?
 
J

John Dunlop

Andy Dingley:

[...]
If you want to "recommend" saving rather than display, then send a
content-type that's likely to do this for most browsers. As you don't
say what your content is, then it's hard to recommend one (although
application/octet-stream might do the trick).

RFC2616 : 19.5.1 says:

| If [Content-Disposition] is used in a response with the
| application/octet-stream content-type, the implied
| suggestion is that the user agent should not display
| the response, but directly enter a `save response
| as...' dialog.

http://www.ietf.org/rfc/rfc2616.txt

Not only do I find this paragraph odd and wholly unnecessary, coming
from (an appendix of) the HTTP spec, but I also regard
Content-Disposition (spit!) on the WWW as pernicious. Don't get me
wrong, I think Content-Disposition has its place - mail rather than the
WWW.
 
D

Dan

thisis said:
i use ms-internet explorer 6.0,

What *you* use shouldn't be particularly relevant to your design of a
Web site, since it is going to be viewed in the browsers your users
use. If you follow the standards properly, you have the best chance of
the site being usable to a broad range of users with a broad range of
browsers and settings.
 
T

thisis

Dan said:
What *you* use shouldn't be particularly relevant to your design of a
Web site, since it is going to be viewed in the browsers your users
use. If you follow the standards properly, you have the best chance of
the site being usable to a broad range of users with a broad range of
browsers and settings.

Hi Dan,

what standars do you mean? - can you supply a link?
 
E

Ed Mullen

thisis said:
Hi Ed Mullen,

i farmilliar with w3 site, each time i read their recomdies, i can't my
head nor my feet,
it's so complex tearms.

thanks for the other links, i haven't scan them yet.
But, that does not belie the fact that you need to understand the
concept of standards which you have indicated that you don't understand.
If you make a page for IE, or only evaluate in IE, then you tell us
that you don't "get" standards, which were created to resolve the exact
problem you claim to have.

So. Code/write first for compatibility. All else will follow.


--
Ed Mullen
http://edmullen.net
http://mozilla.edmullen.net
http://abington.edmullen.net
Better living through denial.
 
T

thisis

Ed said:
But, that does not belie the fact that you need to understand the
concept of standards which you have indicated that you don't understand.
If you make a page for IE, or only evaluate in IE, then you tell us
that you don't "get" standards, which were created to resolve the exact
problem you claim to have.

So. Code/write first for compatibility. All else will follow.


--
Ed Mullen
http://edmullen.net
http://mozilla.edmullen.net
http://abington.edmullen.net
Better living through denial.

Hi Ed,

thanks for the links!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top