ftp upload error

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
hi all

i posted a little while ago about this, but am getting no further ahead.
does anybody have a clue as to why this script doesn't upload my files any
longer (all it does is stick a 1kb file on the server which can't be read).
i'm not sure if the script thinks the file is only 1kb large or if the
problem is somewhere else.  the server is freeBSD, PHP version 4.  any
ideas? tks.

 $sTargetDir = trim($HTTP_POST_VARS['destDir']);
    $sOriginalFileName = $HTTP_POST_FILES['srcFile']['name'];
 $sImgPrefix = trim($HTTP_POST_VARS['imgCategory']);
 if($sTargetDir == "/public_html/images/" || $sTargetDir ==
"/public_html/ezine/images/"){ // it's an image - attach the image category
prefix //
  $sFileName = $sImgPrefix . str_replace(" ", "_", $sOriginalFileName);
  $sFileName = str_replace(" ", "_", $sOriginalFileName);
 $sFolder = str_replace("/public_html/", "", $sTargetDir);
 $sFullDestinationPath = $sTargetDir . $sFileName;
 if($_POST['destDir'] == ""){
  die("Error: No destination directory selected. Upload aborted. Please
click your back button and try again.");
  $oFTPConn = ftp_connect($sFtpServer,21,9600) or die("Unable to connect to
$sFTPServer!"); //login to the ftp server and upload the file //
  $cmdLogin = ftp_login($oFTPConn, $sFtpUserName, $sFtpPassWord) or
die("Unable to connect to login to the FTP server: $sFTPServer!");
  $cmdUpload = FTP_NB_PUT($oFTPConn, $sFullDestinationPath,
$_POST['srcFile'], FTP_BINARY);
  while ($cmdUpload == FTP_MOREDATA){
     $cmdUpload = FTP_NB_CONTINUE($oFTPConn);
  $cmdCloseFTP = ftp_close($oFTPConn);
  if (!$cmdUpload){ //check to see if the file was successfully uploaded //
   $sResponseMsg = "<h1>Error</h1><p>Unable to upload file to server.</p>";
   $sResponseMsg = "<span style='text-decoration:
underline;'>$sFileName</span> was uploaded successfull to $sTargetDir.";

Re: ftp upload error

Nancy Drew wrote:
Quoted text here. Click to load it

Quoted text here. Click to load it
Quoted text here. Click to load it

Isn't  < $_POST['scrFile'] >  an array?

Doesn't ftp_nb_put() take a string as its third parameter?

When you have an array and treat is as a string the result can be
misleading :-)

Mail to my "From:" address is readable by all at http://www.dodgeit.com /
== ** ## !! ------------------------------------------------ !! ## ** ==
may bypass my spam filter. If it does, I may reply from another address!

Re: ftp upload error

Quoted text here. Click to load it
Quoted text here. Click to load it

yeah, that was the problem.  tks pedro.
Quoted text here. Click to load it

Site Timeline