Forum Moderators: coopster

Message Too Old, No Replies

Downloading files via a Form

         

trinsic

7:37 am on Sep 18, 2006 (gmt 0)

10+ Year Member



What I need for a website of mine is the ability to download a file if the id is given. Eg. http://example.com/download/$id.zip

If $id was the ID given it would download that file.

Any help would be great :)

[edited by: coopster at 12:00 pm (utc) on Sep. 18, 2006]
[edit reason] examplified url [/edit]

henry0

12:35 pm on Sep 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



trinsic Welcome to WebmasterWord!

A little search here Results in [webmasterworld.com]
Scroll down, very easy to create.

I could have written it but using the search shows you how much of good info one may find on premises :)

Edit:
May be I did not get it
Do you want to know about d-loading a zip?
or what to do if $id is correct?

trinsic

5:05 am on Sep 19, 2006 (gmt 0)

10+ Year Member



Thanks for the welcome :)

Had a look at that other thread but not really what I am looking for.

If the $id was correct then send them off to download the file. Lets say they put 1234 in a form and submitted it. If 1234.zip existed then it would download it.

Steerpike

5:50 am on Sep 19, 2006 (gmt 0)

10+ Year Member




Hmm, while it's possible to generate an href to the resultant file (if it exists) from a user inputted value, I don't believe it's possible to 'skip the middle man' and just start downloading a file based on information that inputted into the form (since that would be a security risk).

You would have to:
1. Get the value.
2. Find the file.
3. Create an href link to it that the user could then click.

Does that describe what you had in mind?

trinsic

11:12 am on Sep 19, 2006 (gmt 0)

10+ Year Member



Yeah I guess I would have to go that way.

I will try that out tomorrow and if I get any problems I will be back :)

trinsic

12:06 am on Sep 20, 2006 (gmt 0)

10+ Year Member



Cool got it working :)

Thanks people for your help.