Jump to content

Archived

This topic is now archived and is closed to further replies.

amalosoul

How can I?

Recommended Posts

I don't want to upload files I want to allow people to choose a file and then to download it, how can I do this with PHP?

Share this post


Link to post
Share on other sites
Make a link to it in your html:
[code]
<a href="http://www.yoursite.com/file/path/filename.ext">Download this file</a>
[/code]

I know that's not the answer you're looking for, but your question was rather vague.  Why don't you be a little more specific about how you're deciding what files to offer for download or some source code.

It's like joining an automobile enthusiasts forum and saying, "How do I build a car?"  Well, lots of ways.

Share this post


Link to post
Share on other sites
Well, for example I have an archive and when you hit a link I want the browser to display where on my computer I want to download that archive (c:\ or d:\ etc) - maybe even to be able to create a folder on the remote machine where to copy that archive...
I hope that this information is sufficient...

Share this post


Link to post
Share on other sites
[quote]maybe even to be able to create a folder on the remote machine where to copy that archive[/quote]

You cannot do ANYTHING on the client with php except create cookies.

Share this post


Link to post
Share on other sites
The functionality of creating folders on the client machine is usually available through the Save dialog box anyways.

Creating a link to download a file is as simple as creating the [code]<a href></a>[/code] that I gave you above.  If there's multiple items you want to offer for download, you have to create a bunch of those links, one for each item.

The thing that differs is how you build the list.  If you have 100 files you want to offer for download, you certainly don't want to type that out 100 times.  And you certainly want it to stay up to date with which archives are actually valid and available for download.

We can help you do that, but not without you being more specific about where these files are stored, how your website "knows" about them, etc.

Share this post


Link to post
Share on other sites
Well, I have tried using a href but all it does is to open the file:).
I have a text document http://myhost.com/location/file.txt
and when I write <a href="http://myhost.com/location/file.txt">Click</a> it simply opens that text file
it does not try to download it to the remote machine...
Thank you roopurt18 for your pacience, and thorpe for providing me that useful piece of information (I think I will start learnig Java to compensate for these things)...

Share this post


Link to post
Share on other sites
It doesn't try to download it because .txt files are easily opened within the browser.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.