• 0

Remote File upload script [PHP]


Question

7 answers to this question

Recommended Posts

  • 0

<?php

// Initialise variables
$remoteUrl = "https://www.neowin.net/neologo.gif";
$localPath = "images/myneologo.gif";

// Read remote file into a string
$remoteFile = implode(file($remoteUrl),"");

// Write that string to a file
$filePointer = @fopen($localPath,"w");
fwrite($filePointer,$remoteFile);
fclose($filePointer);

?>

It might not work because I haven't actually tested that code together but it should... and it could with a little work if it doesn't already :)

  • 0

Thanks, I tried that, but I got this

Warning: fwrite(): supplied argument is not a valid stream resource in /home/evilpig/public_html/host/include.php on line 12

Warning: fclose(): supplied argument is not a valid stream resource in /home/evilpig/public_html/host/include.php on line 13

I also changed it to be run by a form,

$remoteUrl = $_POST['file'];
$localPath = $_POST['this'];

EDIT: I was also referred to this

http://www.phpclasses.org/browse/package/2221.html

Maybe if you also looked there that could also help you help me. :p

(I am a php noob by the way, sort of)

Edited by evilpig
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.