473,382 Members | 1,365 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Downloading files

I'm currently constructing a site one page of which I wish to allow
the user to select from a number of different file type downloads. The
file types will be .docs .jpgs mp3.
I know how to transfer the files to the server but what code do I need
to use to allow user to select and download specific files? Obviously
they can right click on an image and download it that way but what
about zipped files?

Regards Tony
Jul 20 '05 #1
15 3066
In article <9e*************************@posting.google.com> ,
tony melnyk <to**@melnyk.freeserve.co.uk> wrote:
[...] what code do I need
to use to allow user to select and download specific files? Obviously
they can right click on an image and download it that way but what
about zipped files?


Simply create links to the files:

<a href="foo.zip">Download foo.zip</a>.

--
Jon Bell <jt*******@presby.edu> Presbyterian College
Dept. of Physics and Computer Science Clinton, South Carolina USA
Jul 20 '05 #2
to**@melnyk.freeserve.co.uk (tony melnyk) wrote:
I'm currently constructing a site one page of which I wish to allow
the user to select from a number of different file type downloads.
The file types will be .docs .jpgs mp3.
Those are not file types in the Internet context. On the Internet, the
type of a file is indicated by its "Internet media type", such as
application/msword, image/jpeg, or video/mpeg.
I know how to transfer the files to the server but what code do I
need to use to allow user to select and download specific files?
You need to provide links to the files, and you should check that the
server sends a correct Content-Type header.
Obviously they can right click on an image and download it that way
but what about zipped files?


You can link to zipped files (application/zip) too. Some people have
software that can handle them. Beware that far from "forcing a
download", zipping makes it (namely direct download of the original,
real file format) _impossible_.

Actually you would have got this information faster by checking the
FAQ, specifically
http://www.htmlhelp.com/faq/html/med...download-howto

Well, admittedly the FAQ is a bit dusty now, and contains even
questionable advice regarding application/octet-stream.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #3
On Sat, 7 Feb 2004 07:18:05 +0000 (UTC), Jukka K. Korpela
<jk******@cs.tut.fi> wrote:
You can link to zipped files (application/zip) too. Some people have
software that can handle them.


Some?

I would think a better word would be "many", but that's not based on
anything empirical.
Jul 20 '05 #4
Neal <ne*****@spamrcn.com> wrote:
You can link to zipped files (application/zip) too. Some people have
software that can handle them.


Some?

I would think a better word would be "many", but that's not based on
anything empirical.


Undoubtedly "many" would be objectively correct too. But I think "some"
is a better one in this context, since the point is that only some
people have such software. Actually, many people are still using e.g.
old Windows systems that do not contain any unzipping program unless
such a program has specifically been installed. (Besides, even if there
is such a program in the user's system, there's no guarantee that he
can use it.)

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #5
On Sun, 8 Feb 2004 00:15:04 +0000 (UTC), Jukka K. Korpela
<jk******@cs.tut.fi> wrote:
Neal <ne*****@spamrcn.com> wrote:
You can link to zipped files (application/zip) too. Some people have
software that can handle them.


Some?

I would think a better word would be "many", but that's not based on
anything empirical.


Undoubtedly "many" would be objectively correct too. But I think "some"
is a better one in this context, since the point is that only some
people have such software. Actually, many people are still using e.g.
old Windows systems that do not contain any unzipping program unless
such a program has specifically been installed. (Besides, even if there
is such a program in the user's system, there's no guarantee that he
can use it.)


So I'd think it would be wise to provide a link to a free unzipper program
if you're offering zips. In fact, there are probably free Word file
viewers which you could link to as well.

Interesting - what files do we feel a user should be expected to be able
to handle? Clearly html, jpg, gif. Others?
Jul 20 '05 #6
Neal wrote:

there are probably free Word file viewers which you could link to
as well.
I'd be surprised if such a thing existed.
what files do we feel a user should be expected to be able to
handle? Clearly html, jpg, gif. Others?


I assume text/html and text/plain. I don't assume too much beyond that.

--
Brian (follow directions in my address to email me)
http://www.tsmchughs.com/

Jul 20 '05 #7
Brian wrote:
Neal wrote:

there are probably free Word file viewers which you could link to
as well.


I'd be surprised if such a thing existed.


Surprise:

<http://office.microsoft.com/downloads/2000/wd97vwr32.aspx>

sherm--

Jul 20 '05 #8
Sherm Pendley wrote:
Brian wrote:
Neal wrote:
there are probably free Word file viewers


I'd be surprised if such a thing existed.


Surprise:
<http://office.microsoft.com/downloads/2000/wd97vwr32.aspx>


:-)

--
Brian (follow directions in my address to email me)
http://www.tsmchughs.com/

Jul 20 '05 #9
Neal <ne*****@spamrcn.com> wrote:
So I'd think it would be wise to provide a link to a free unzipper
program if you're offering zips.
Not really. For example, if someone is using WinXP, he should probably
learn to understand the built-in unzipper rather than look for
something new.

If you offer zips as alternatives to HTML format, just offer them. If
you like, add a link to a page that explains what zip is about, in
layman terms, if you know one.

If you offer zips as the only alternative, a large number of users will
just go elsewhere.
In fact, there are probably free
Word file viewers which you could link to as well.
Even more pointless. Who's going to download tens of megabytes of
OpenOffice just to view a document that could be loaded and shown in no
time if it were in HTML?
Interesting - what files do we feel a user should be expected to be
able to handle? Clearly html, jpg, gif. Others?


All user agents can handle those, properly served, or present the
author-supplied fallback (the alt attribute) for images. They can also
deal with text/plain (mostly). What else do you need? Surely there are
lots of applications that could be used to enhance pages, but I don't
think we are talking about interactive animations and things like that
here. PDF and Word are just proprietary and inflexible formats for
things that can mostly be better expressed in HTML, for the purposes of
WWW authoring.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #10
On Sun, 8 Feb 2004 21:41:15 +0000 (UTC), Jukka K. Korpela
<jk******@cs.tut.fi> wrote:
Neal <ne*****@spamrcn.com> wrote:
In fact, there are probably free
Word file viewers which you could link to as well.


Even more pointless. Who's going to download tens of megabytes of
OpenOffice just to view a document that could be loaded and shown in no
time if it were in HTML?


I agree - was just for the sake of argument.
Interesting - what files do we feel a user should be expected to be
able to handle? Clearly html, jpg, gif. Others?


All user agents can handle those, properly served, or present the
author-supplied fallback (the alt attribute) for images. They can also
deal with text/plain (mostly). What else do you need?


I don't, but someone might think they do. When they find this archived
somewhere in the future, they'll know then.
Jul 20 '05 #11
Brian <us*****@julietremblay.com.invalid-remove-this-part> wrote in
news:mHrVb.205455$nt4.975966@attbi_s51:
Neal wrote:
what files do we feel a user should be expected to be able to
handle? Clearly html, jpg, gif. Others?


I assume text/html and text/plain. I don't assume too much beyond that.


image/png is pretty safe as long as you don't rely on alpha channel
support. audio/mpg (or should that be audio/mpeg) is also pretty safe as
long as you just link to it rather than embed it.
Jul 20 '05 #12
Eric Bohlman wrote:
Brian wrote
Neal wrote:
what files do we feel a user should be expected to be able to
handle? Clearly html, jpg, gif. Others?
text/html and text/plain. I don't assume too much beyond that.


image/png is pretty safe as long as you don't rely on alpha channel
support.


As J. Korpela pointed out, images formats are appropriate if
appropriate fallback is available. That is a general principle.
audio/mpg (or should that be audio/mpeg) is also pretty
safe as long as you just link to it rather than embed it.


Anything is safe if you link to it. But I don't *assume* the user will
have what is necessary to access it, outside of the two I mentioned
above.

--
Brian (follow directions in my address to email me)
http://www.tsmchughs.com/

Jul 20 '05 #13
Tim
Neal wrote:
what files do we feel a user should be expected to be able to
handle? Clearly html, jpg, gif. Others?


Brian <us*****@julietremblay.com.invalid-remove-this-part> wrote:
I assume text/html and text/plain. I don't assume too much beyond that.


Even plain text isn't platform generic:

The end-of-line characters being the common pitfall (different systems
use different ones, and handle alternative system's methods with varying
degrees of success).

The character set being another. Trying to view a Mac written plain
text file on another computer often ends up with some gibberish
characters.

And some people's ideas about what's a plain text file are quite wrong.

--
My "from" address is totally fake. The reply-to address is real, but
may be only temporary. Reply to usenet postings in the same place as
you read the message you're replying to.

This message was sent without a virus, please delete some files yourself.
Jul 20 '05 #14
On Mon, 9 Feb 2004, Tim wrote:
Even plain text isn't platform generic:

The end-of-line characters being the common pitfall (different systems
use different ones, and handle alternative system's methods with varying
degrees of success).
Fair comment
The character set being another. Trying to view a Mac written plain
text file on another computer often ends up with some gibberish
characters.
Not really, at least with HTTP: that's no different for text/plain
than it is for text/html, so long as the server is doing what it
should and supplying the correct character encoding value on the
charset= attribute of the Content-type header.

(Quite a number of present-day non-Mac-platform browsers support Mac
encodings, for text/html as for text/plain, even though I'd rate the
use of proprietary Mac encodings for interworking as being at least as
rude as using some Other Vendor's proprietary encodings in such a
situation.)
And some people's ideas about what's a plain text file are quite wrong.


There's an RFC that defines it. I give you
http://www.cis.ohio-state.edu/cgi-bi...html#sec-4.1.3

Sure, there's a major vendor who sees fit to disregard the RFCs
whenever it suits them, but until they manage to fool enough of the
great unwashed into preferring their proprietary network instead of
the open-protocol Internet (and we can see they're working hard at
that, let's just hope that the public wake up before it's too late),
the RFCs are the right way to go.

Jul 20 '05 #15
Tim
Tim wrote:
Even plain text isn't platform generic:

...[snip]...

The character set being another. Trying to view a Mac written plain
text file on another computer often ends up with some gibberish
characters.

"Alan J. Flavell" <fl*****@ph.gla.ac.uk> wrote:
Not really, at least with HTTP: that's no different for text/plain
than it is for text/html, so long as the server is doing what it
should and supplying the correct character encoding value on the
charset= attribute of the Content-type header.
That was my main concern: Often, the user won't have control over that,
or doesn't know about it, or know what to do with it.
(Quite a number of present-day non-Mac-platform browsers support Mac
encodings, for text/html as for text/plain, even though I'd rate the
use of proprietary Mac encodings for interworking as being at least as
rude as using some Other Vendor's proprietary encodings in such a
situation.) And some people's ideas about what's a plain text file are quite wrong.

There's an RFC that defines it. I give you
http://www.cis.ohio-state.edu/cgi-bi...html#sec-4.1.3
I was thinking more of a user issue, though: Some people think that if
they use WordPad without playing with fonts and things, or SimpleText,
and just save the file "as-is," that they're making a plain text
document. Likewise for those who think that renaming a .doc file to a
..txt file converts it. It's not obvious, to them, that they've created
something that's not plain text.
the RFCs are the right way to go.


No argument from me. Doing things to a standard is the only way to
achieve interoperability and maintainability.

--
My "from" address is totally fake. The reply-to address is real, but
may be only temporary. Reply to usenet postings in the same place as
you read the message you're replying to.

This message was sent without a virus, please delete some files yourself.
Jul 20 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Luke StClair | last post by:
Only marginally belonging in this newsgroup... but oh well. I've just started writing in python, and I want to make the files available on the web. So I did the standard <a...
0
by: sales | last post by:
If you are having difficulty downloading large files, please check out www.Downloads4Dialups.com. Mention this newsgroup in the "Special Instructions" window on the Shipping Form, and receive a...
2
by: Bala | last post by:
Hi I am trying to download the PDF files from my webserver using ASP.Net. All my files are stored at F Drive on webserver. Like this F:\Main Folder\Sub Folder\Files\File1.pdf I am...
1
by: just.starting | last post by:
Hi, My dot net client downloads files and checks for any new files time to time. The server is apache2.0.53 server. So what happens is that my file download thing works fine if I dont try to call...
3
by: just.starting | last post by:
Hi, My dot net client downloads files and checks for any new files time to time. The server is apache2.0.53 server. So what happens is that my file download thing works fine if I dont try to call...
0
by: just.starting | last post by:
I am having problem while downloading files from an apache server2.0.53 with php4.3.10.While downloading some files it generally stops after downloading some specific amount and then stops...
4
by: aldonnelley | last post by:
Hi there: a bit of a left-field question, I think. I'm writing a program that analyses image files downloaded with a basic crawler, and it's slow, mainly because I only want to analyse files...
3
by: xeroxero | last post by:
I would like to prevent people from downloading a .zip from a ASP.NET 2.0 web site, but still allow people to touch a .aspx page in the same directory. I also want to set things so if a user clicks...
1
by: =?Utf-8?B?U2FjaGluIENoYXZhbg==?= | last post by:
Hi, I need to download files from the FTP location. This FTP location is readonly n I dont hv access to delete files from this location once downloaded. The files to the ftp location keeps...
7
by: Ehsan | last post by:
I foundd this code in ASPN Python Cookbook for downloading files in python but when it finished downloading files the files became corrupted and didn't open, the files in internet havn't any...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.