Jump to content

PHP Download


spinFIRE

Recommended Posts

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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.