Problems with uploading! Help please!
Posted: Mon Mar 01, 2004 3:25 am
Hello to everybody,
I have a problem with uploading a file. Using the following code:
if(is_uploaded_file($_FILES["foto"]["tmp_name"]))
{
//check type and syze
if ($_FILES["foto"]["name"] != "") {
$imageType = $_FILES["foto"]["type"];
// Check MIME Type
$inpiccolo = strtolower($imageType);
if (($inpiccolo != "image/png") && ($inpiccolo != "image/pjpeg") && ($inpiccolo != "image/jpeg") && ($inpiccolo != "image/gif"))
die("<center><h1>Puoi selezionare solo file di immagini</h1></center>");
}
if($_FILES["foto"]["size"] > 62000)
die("<center><h1>Puoi selezionare solo foto di dimensione max. 60 KB</h1><center>");
//set the URL for the upload
$path = "images/offerte/".$_FILES["foto"][" name"];
//upload the file
move_uploaded_file($_FILES["foto"]["tmp_name"], $path);
}
I try to upload an image as you can see from the code! the problem is the it works fine in local but it doesn't when I use it in the server!
I also tried to use $HTTP_POST_FILES instead of $_FILES but it doesn't work either! You can check the php configuration of the server at http://www.k2club4wd.com/nuovomare/phpinfo.php so you can tell me if there is some problem that i don't know as i'm new at php! thank you very much anyway! I was forgetting...move_uploaded_file(...) return false without any warning if this may help!
I have a problem with uploading a file. Using the following code:
if(is_uploaded_file($_FILES["foto"]["tmp_name"]))
{
//check type and syze
if ($_FILES["foto"]["name"] != "") {
$imageType = $_FILES["foto"]["type"];
// Check MIME Type
$inpiccolo = strtolower($imageType);
if (($inpiccolo != "image/png") && ($inpiccolo != "image/pjpeg") && ($inpiccolo != "image/jpeg") && ($inpiccolo != "image/gif"))
die("<center><h1>Puoi selezionare solo file di immagini</h1></center>");
}
if($_FILES["foto"]["size"] > 62000)
die("<center><h1>Puoi selezionare solo foto di dimensione max. 60 KB</h1><center>");
//set the URL for the upload
$path = "images/offerte/".$_FILES["foto"][" name"];
//upload the file
move_uploaded_file($_FILES["foto"]["tmp_name"], $path);
}
I try to upload an image as you can see from the code! the problem is the it works fine in local but it doesn't when I use it in the server!
I also tried to use $HTTP_POST_FILES instead of $_FILES but it doesn't work either! You can check the php configuration of the server at http://www.k2club4wd.com/nuovomare/phpinfo.php so you can tell me if there is some problem that i don't know as i'm new at php! thank you very much anyway! I was forgetting...move_uploaded_file(...) return false without any warning if this may help!