July 12th, 2002, 10:30 PM
I've been pouring over the following code all day, but can't seem to get it work. I appreciate anyone that can point out any errors.
$imageUpFile = $_FILES['file']['tmp_name'];
$imageType = $_FILES['file']['type'];
$imageName = $_FILES['file']['name'];
echo" $imageUpFile, $imageType, $imageName";
//Open the uploaded pic (temp file)
if ($thePic = fopen ($imageUpFile, "rb"))
//read temp file into var
$savePic = fread($thePic, filesize($imageUpFile));
//Open a new file in the correct directory using the name of the uploaded pic file
if ($fileHandle = fopen("ftp://username:firstname.lastname@example.org/htdocs/www/uploads/$imageName","w"))
//Put data into just opened file pointer
if (fwrite ($fileHandle, $savePic))
echo "file <b>$imageName</b> successfully written";
echo "file <b>$imageName</b> was NOT written";
// The file was not created. Inform the user.
echo "<b> The file: $imageUpFile could not be created!</b>";
July 13th, 2002, 02:01 AM
use instead the ftp functions.
July 13th, 2002, 02:56 PM
Is there anything wrong with you using the copy() or move_uploaded_file() functions? It makes more sense to me to use this in your instance.