Hiya - I'm trying to let users upload gif's or jpeg's via FTP. I thought I was smart when I successfully did a GIF, but when i try JPEG's I get an error: "Warning: ftp_put(): error opening mypic.jpeg in /home/fakename/www/www/sam2/test.php on line 28 did not work." Hmm. Here is my code:
(connect to FTP)
$pic1 = $FILES['pic1']['name'];
$pic1_type = $FILES['pic1']['type'];
$pic1_size = $_FILES['pic1']['size'];
if ($pic1_size > 0) { // see if something in input form
$pic_id = "$some_variable";
if ($pic1_type=="image/gif") {
$pic_path = "$pic_id" . ".gif";
}
elseif ($pic1_type=="image/jpg") {
$pic_path = "$pic_id" . ".jpg";
}
elseif ($pic1_type=="image/jpeg") {
$pic_path = "$pic_id" . ".jpeg";
}
elseif ($pic1_type=="image/pjpeg") {
$pic_path = "$pic_id" . ".jpeg";
}
ftp_put($conn_id, $pic_path,$pic1, FTP_BINARY);
Anyone else have a prob with this? P.S. I wrote this myself so if there is a better way to put an extension on $some_variable to make it match what kind they uploaded I would love to know. Gracias.