ftp_nb_put() resulting in wierd file contents
Posted: Mon Mar 19, 2007 9:51 am
Hi all,
I'm using the following code to upload a user-specified file (of image, audio or video filetype) to a server that is remote to the one that hosts the script.
The transfer is not working properly. Although a file with the correct name is created in the correct place on the remote server, the contents (regardless of filetype) are always the HTML you would expect to see for a directory index listing.
Can anyone suggest why this may be happening and what can be done to fix it?
Many thanks,
Matt
I'm using the following code to upload a user-specified file (of image, audio or video filetype) to a server that is remote to the one that hosts the script.
Code: Select all
ftp_pasv($ftpConn,true);
$ftp = ftp_chdir($ftpConn,$ftp->userFilePath.'/'.$fileType) or die(error::errorReport('changeDirFail'));
$ftp = ftp_nb_put($ftpConn,$fileName,$configs['mediaserver'].$_SESSION['pcu_username'].'/'.$fileType,FTP_BINARY) or die(error::errorReport('fileFTPFail'));
while ($ftp == FTP_MOREDATA) {
$ftp = ftp_nb_continue($ftpConn);
}
if ($ftp != FTP_FINISHED) {
echo _FTP_FAIL_ ;
exit(1);
}
$ftp = ftp_close($ftpConn);
if($ftp) echo "transfer complete";Can anyone suggest why this may be happening and what can be done to fix it?
Many thanks,
Matt