amalosoul Posted October 9, 2006 Share Posted October 9, 2006 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? Link to comment https://forums.phpfreaks.com/topic/23465-how-can-i/ Share on other sites More sharing options...
roopurt18 Posted October 9, 2006 Share Posted October 9, 2006 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. Link to comment https://forums.phpfreaks.com/topic/23465-how-can-i/#findComment-106463 Share on other sites More sharing options...
amalosoul Posted October 9, 2006 Author Share Posted October 9, 2006 Ok, thanks I will try this idea:).I thought it has something to do with $_FILE. Link to comment https://forums.phpfreaks.com/topic/23465-how-can-i/#findComment-106465 Share on other sites More sharing options...
amalosoul Posted October 9, 2006 Author Share Posted October 9, 2006 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... Link to comment https://forums.phpfreaks.com/topic/23465-how-can-i/#findComment-106474 Share on other sites More sharing options...
trq Posted October 9, 2006 Share Posted October 9, 2006 [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. Link to comment https://forums.phpfreaks.com/topic/23465-how-can-i/#findComment-106517 Share on other sites More sharing options...
roopurt18 Posted October 9, 2006 Share Posted October 9, 2006 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. Link to comment https://forums.phpfreaks.com/topic/23465-how-can-i/#findComment-106522 Share on other sites More sharing options...
amalosoul Posted October 12, 2006 Author Share Posted October 12, 2006 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.txtand when I write <a href="http://myhost.com/location/file.txt">Click</a> it simply opens that text fileit 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)... Link to comment https://forums.phpfreaks.com/topic/23465-how-can-i/#findComment-107939 Share on other sites More sharing options...
roopurt18 Posted October 13, 2006 Share Posted October 13, 2006 It doesn't try to download it because .txt files are easily opened within the browser. Link to comment https://forums.phpfreaks.com/topic/23465-how-can-i/#findComment-108189 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.