PDA

View Full Version : File Upload Issue



mburt
01-05-2007, 05:41 PM
This script:

<?php
$target_path = "ftp://****:****@oriosisedge.infinites.net/comics/$_POST[shortFile]";

$target_path = $target_path . basename( $_FILES['uploadedfile']['']);

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
Won't work. Although, without the red part, it works fine. What I'm aiming to do is to be able to upload a file from the users pc to another ftp server.
:confused:

djr33
01-06-2007, 06:10 AM
Ermm... I don't think that ftp works like that in PHP. In fact, i'm sure it doesn't.

Look up the FTP functions for php:
http://www.php.net/manual/en/ref.ftp.php

Also, using the user:pass@ftp format might not work, since php needs a specific format for the ftp connect function.

mburt
01-06-2007, 08:02 PM
Yeah, I was actually looking at the php.net documentation, and found that it didn't help much. Then I found a link posted by Twey through searching the forums, which led me to exactly what I needed. I got it to work on my own ftp directory, but I wanted to export to an alternate directory (it has 100 megs of space, so I post all my images there). I guess using that method won't work.
I also thought about the root thingy:
user/mburt/...
I'm wondering if I could use that in place of the ftp url?