|
Posted by J.O. Aho on 05/27/07 11:46
Zoe Brown wrote:
> I have the following simple script. But I am getting the error message "FTP
> upload failed!" Which is annoying. Why might this be ?
>
> the files i have tried are tiny .txt and jpeg.
> $upload = ftp_put($conn_id, $file, $file, FTP_ASCII);
>
> // check upload status
> if (!$upload)
> {
//if you aren't going to use the $upload value, then you can use
//if(!ftp_put($conn_id, $file, $file, FTP_ASCII)) {
//instead of if (!$upload) {
> echo "FTP upload has failed!<br>";
> }
> else
> {
> echo "Uploaded $source_file to $ftp_server as $file<br>";
//no point in setting $upload to true, it's already true or
//else you would have got the "FTP upload has failed!" message
> $upload = True;
> }
It could be so that the directory whereto you come when you login to the ftp
server isn't writable for the user as you are logged in, you may have to
change to an upload directory (use ftp_chdir()).
--
//Aho
Navigation:
[Reply to this message]
|