Jump to content


Photo

FTP+PHP Problem


  • Please log in to reply
1 reply to this topic

#1 anoopsinghal

anoopsinghal
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 16 September 2006 - 06:32 PM

Dear All,

I am using the following code for doing ftp upload it doesn't show up any error but the file is not uploaded.

I will be highy thankful if someone solves the problem

<?php
$HOST=$_SESSION["host"];
$UN=$_SESSION["username"];
$PW=$_SESSION["password"];
$conn = ftp_connect($HOST);
if(!$conn) {
echo("Could not connect to server: $HOST\n");
}
if(!ftp_login($conn,$UN,$PW)) {
echo("Could not log in\n");
}

ftp_pasv($conn,true);
$filenew=$_POST["filenew"];
$file=$_POST["file"];

$basename= preg_replace( '/(\\\\\\\\)/', '/', $filenew);
$file='.'.$file.'/'.basename($basename);

echo("file".$file);
echo("filenew".basename($basename));

$upload = ftp_put($conn,basename($basename),$file,FTP_BINARY);

if (!$upload) {
echo "FTP upload has failed!";
} else {
echo "Uploaded $source_file to $ftp_server as $destination_file";
}
ftp_close($conn);
?>


#2 markbett

markbett
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 16 September 2006 - 06:59 PM

what do your ftp logs say??




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users