Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
My webhost wrote a php script for me. It basically allows me to have the server download files. This is so I dont have to dl a file and then upload it. With the script I can simply cut on the middle man (myself ). Here it is
[b]save.php[/b]Code: Select all
<?PHP
$newfilename = $_GET["new"];
$download = $_GET["source"];
//$file is the url that is definied by source(.php?source=) which will be (f)open as (r)eadable.
$file = fopen("http://" . $download, "rb");
//Open a new blank file which is writeable. New filename is $newname value, which is $download after having stuff replaced.
$savename = fopen($newfilename, "w+b");
//Open $file which was the opened binary of $download, then read it at 8192 bytes at a time
while ($tmpread=fread($file, 8192) ) {
//Write the data value of $tmpread to $savename
if (fwrite($savename, $tmpread) === FALSE) {
echo "Cannot write to file ($savename)";
exit;
}
}
//Close $savename BEFORE $file, since its still inuse
fclose($savename);
//Now close $file since nothing is using it
fclose($file);
?>upload.php
Code: Select all
<form method="get" action="save.php">
Logged IP is:
<input type="text" id="date3" disabled="true" value="<?php echo getenv("REMOTE_ADDR");?>" />
<br />
<br />
File:
<input name="source" type="text" value="">
<br />
<br />
Save As:
<input name="new" type="text" />
<br />
<br />
<input name="submit2" type="submit" value="Submit" />
<input name="Reset22" type="reset" value="Reset" />
</form>I realize the best solution may not be to do this in two files, but I was working off of another example and it was the only way I knew how to go about it. If someone can provide some feedback or even some advice on how to do it with one page that would be great. Thanks.
JayBird | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]