What the...? - Problems with FTP_PUT 
Author Message
 What the...? - Problems with FTP_PUT

I've got a form which lets users select and then FTP_PUT a .PPT doc up to
the server into a directory specified by them. It works on the local box,
but from a remote connection I get:

Warning: error opening C:\\docs\\test.ppt in ftpup.php on line 55

Line 55 is:
$upload = ftp_put($conn_id, stripslashes($parentDir . "/" . $subDir . "/" .
$theFile), $file, FTP_BINARY);

Here's the whole thing:
...FTP login stuff...

$parentDir = $dir;//parent directory where the file is going
$subDir = $userName;//sub directory for file
$file = $fileName;//the file

//the fileName variable has the complete directory path so
//we must strip off everything but the name of the file itself
//in order to give the ftp_put command a name for new file
$theFile = explode("\\", stripslashes($fileName));
$theFile = end($theFile);

//get the extension of the file and reject if its not powerpoint
$ext_array = explode(".",$theFile);
$last_position = count($ext_array) - 1;
$ext = $ext_array[$last_position];
if($ext == "ppt"){
//go ahead and upload it

echo "parentDir = " . $parentDir . "<br>";
echo "subDir = " . $subDir . "<br>";
echo "file = " . $file . "<br>";

//if the directory doesn't exist yet make one

ftp_mkdir($conn_id, $subDir);

Quote:
}

 //upload the file into the directory
//----------------------------------------------------------------

//$file = stripslashes($file);

$upload = ftp_put($conn_id, stripslashes($parentDir . "/" . $subDir . "/" .
$theFile), $file, FTP_BINARY);

echo "<br><br><strong>file : </strong> " . $file . "<br>";
echo "<strong>Going to : </strong> " . stripslashes($parentDir . "/" .
$subDir . "/" . $theFile) . "<br>";
echo "<strong>Parent Dir : </strong> " . $parentDir . "<br>";
echo "<strong>Sub Dir : </strong> " . $subDir;
flush();

if (is_file($theFile)){
echo "<p><strong>Upload Successful</strong></p>";

Quote:
}else{

echo "<br><strong>FAILED</strong>";
Quote:
}

flush();

// close the FTP stream
ftp_quit($conn_id);

Quote:
}else{

//the extension was not ppt - Kick em out
// close the FTP stream
ftp_quit($conn_id);
header ("location: index.php?avar=badext");

Quote:
}

Can anyone offer guidance?

TIA,
Seth



Wed, 27 Apr 2005 00:54:53 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. ftp_put hangs

2. Problems, problems, problems

3. Eiffel Problems, Problems, Problems

4. Finn Idiom problems and Re: {rho} problem

5. Combinatorial Problem [ & a new Combinatorial Problem ]

6. Database problem/Memory problem??

7. CW 2003 - Focus problem & a select problem

8. 32bit problem - one problem solved & another found

9. GForth problem or my problem?

10. REXX DLL problems solved (was Re: Problems getting C subcommand to work)

11. HTTP-Access2 problem (was Ruby Google problem)

12. Problem with this excercise problem.

 

 
Powered by phpBB® Forum Software