spinFIRE Posted September 12, 2006 Share Posted September 12, 2006 Hey!I want to make or use a (free) script that does this:I browse to the script, and have a form in which I can type an URL:[code]http://www.example.com/100mbfile.zip[/code]Press OK! - and then the server starts to download the file into:[code]/home/download/100mbfile.zip[/code]Can something like this be done, - eventually with a status page which shows percentage of current downloads, size, speed and so on ??? ???-Hope someone can help ;)-spinFIRE Quote Link to comment Share on other sites More sharing options...
gijew Posted September 12, 2006 Share Posted September 12, 2006 I'm not totally sure what it is that you're trying to do. Are you trying to copy a file from the server to a new location? If you type in http://www.example.com/file.zip the browser it is going to force the download and you'll get the file. If you need to get a log of that you could connect to the server logs and count the amount of times it has been accessed. If you're only trying to track downloads and have PHP handle the downloading there should be plenty of free scripts out there that handle file downloads. It's not really all that difficult. Quote Link to comment Share on other sites More sharing options...
ober Posted September 12, 2006 Share Posted September 12, 2006 Sorry, PHP cannot specify a local directory. It is a server side scripting language only. The status/size/speed will all have to be done with something like AJAX. Quote Link to comment Share on other sites More sharing options...
spinFIRE Posted September 12, 2006 Author Share Posted September 12, 2006 Example:When I am not at home, and doesn't have some HD space to save downloads on, I could use a browser and send the link to the server, and then it download it for me. When I get home, it lies in the /home/download/ folder - this was the idea..-spinFIRE Quote Link to comment Share on other sites More sharing options...
gijew Posted September 12, 2006 Share Posted September 12, 2006 You should buy bigger hard drives = )I'm not sure how to go about that but ober is correct about the size/status/etc. PHP can fetch filesize and what not but that's as far as that goes. As far as retrieving the file from a remote location and storing it on the server I would assume you could run a cron job to check every (x) minutes to see if the file exists and download it to a directory with read/write permissions. That would probably cause some strain on the server depending on what you were downloading. Quote Link to comment Share on other sites More sharing options...
shocker-z Posted September 12, 2006 Share Posted September 12, 2006 main code would be along the lines of<?php $filecontent=file_get_contents($_POST['fileurl']);$filename=$_POST['filename'];$fp = fopen("$filename", "w");fwrite($fp, $filecontent);fclose($fp);?>but i'm unsure on the filename so would have to be fetched from a diffrent box as not sure how it would be possible as could be psaces and hiphans and dots and all so not even regex could delete the rest Quote Link to comment Share on other sites More sharing options...
spinFIRE Posted September 12, 2006 Author Share Posted September 12, 2006 It's because I have a server at home, - so I would just go to the ip and the script, enter the URL, and when I get home, it's downloaded..I've tried [url=http://irodov.nm.ru/wget4web/]http://irodov.nm.ru/wget4web/[/url] - but I want something in php (I can understand that ;D)@shocker-z: I will try that tomorrow ;)-spinFIRE Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.