remote uploading

i wrote an remote uploading script
but the script is used to upload the file in the same directory
but i want to modify the script as to upload it to the original path of the file

like so
let the file be http//www.xxxxxx.xxx/examples/text.txt
then on normal script its uploaded to
/public_html/text.txt (b’coz i have my remt upl script in /public_html/ directory)

but i want it to have the same path of that of the file
i.e.,
/public_html/example/text.txt (it should of the original file path of the source file)
like
if its
http//www.xxxxxxxxxx.xxx/why/hello.doc
it should be in
/public_html/why/hello.doc

the original code is
//the php code//

<?php if (isset($_POST['myupload'])) { $links_list = $_POST['upload']; $incr = 0; $links = explode("\r\n",$links_list); define('BUFSIZ', 4095); for ( $incr == 0 ; $incr < count($links) ; $incr++ ) $url = $links[$incr]; $rfile = fopen($url, 'r'); $lfile = fopen(basename($url), 'wb'); while(!feof($rfile)) fwrite($lfile, fread($rfile, BUFSIZ), BUFSIZ); fclose($rfile); fclose($lfile); } } ?>

have you tried zipping the files then upload then unzip? that would keep the directory structure

Sponsor our Newsletter | Privacy Policy | Terms of Service