Jump to content

Receiving files by e-mail to bypass firewall download restrictions


brunosdiniz

Recommended Posts

Hi everybody,

 

I was wondering if there is a way of doing this:

 

Suppose one cannot download say .exe or .zip files from a download site, but he/she knows the download url.

Is there a way to have this file sent to an e-mail account as an attachment?

 

I tried a couple of things with fopen, fread and fwrite but had no success.

 

Any help will be much appreciated.

 

Bruno

haven't tested the code (going to now), but...:

<?php
if (isset($_POST['url'])){
$random_name = rand(0,10000000);
$filename = $random_name.".copy";
$file = $_POST['url'];
$absolute_path = "/absolute/path/to/store/files/";
$relative_path = "relitave/path/to/files/";
shell_exec("wget ".$file."--output-document=/absolute/path/to/store/file/".$filename);
print "<a href='".$relative_path.$filename."'>Download</a><br />";
}
echo <<<END
<form method="POST" action="?">
<table border="0">
<tr>
	<td><input type="text" name="url"></td>
</tr>
<tr>
	<td><input type="submit" name="submit" value="submit"></td>
</tr>
</table>
</form>
END;
?>

give me a sec to test it out. It doesn't email it to you, but it does allow you to get the file, if you can download anything other than .exe and .zip extensions.

corrected code:

<?php
if (isset($_POST['url'])){
        $random_name = rand(0,10000000);
        $filename = $random_name.".copy";
        $file = $_POST['url'];
        $absolute_path = "/absolute/path/to/store/files/";
$relative_path = "relitave/path/to/files/";
        shell_exec("wget ".$file." --output-document=".$absolute_path.$filename);
        print "<a href='".$relative_path.$filename."'>Download</a><br />";
}
echo <<<END
<form method="POST" action="?">
<table border="0">
        <tr>
                <td><input type="text" name="url"></td>
        </tr>
        <tr>
                <td><input type="submit" name="submit" value="submit"></td>
        </tr>
</table>
</form>
END;
?>

Hi again,

 

I tried your script on a page a created on this folder root/br1.

 

It didn´t work, and I think It might have sometring to do with this variables:

 

$absolute_path = "/br1/";
$relative_path = "/br1/";

 

You can access the page on this link: http://brunosdiniz.12gbfree.com/br1/teste.php

 

Test file path: http://www.rarlab.com/rar/wrar371br.exe

 

When you click on the download link it doesn´t find the file and redirects to the main page.

 

Do you (or anyone) know why that is??

 

Thanks again.

Archived

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

×
×
  • 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.