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!
Problems with uploading! Help please!
Moderator: General Moderators
putting error_reporting(E_ALL) i got this warning:
Warning: move_uploaded_file(images/offerte/parafly3.jpg): failed to open stream: Permission denied in D:\Inetpub\webs\k2club4wdcom\nuovomare\store.php on line 30
Warning: move_uploaded_file(): Unable to move 'C:\PHP\uploadtemp\phpF996.tmp' to 'images/offerte/parafly3.jpg' in D:\Inetpub\webs\k2club4wdcom\nuovomare\store.php on line 30
and I found out i didn't have the permission to write to that folder...even if i created that folder! anyway i worked it out, thank you very much!
I have another question though...what's more performing, uploading the file using ftp_put or using move_uploaded_file?
Warning: move_uploaded_file(images/offerte/parafly3.jpg): failed to open stream: Permission denied in D:\Inetpub\webs\k2club4wdcom\nuovomare\store.php on line 30
Warning: move_uploaded_file(): Unable to move 'C:\PHP\uploadtemp\phpF996.tmp' to 'images/offerte/parafly3.jpg' in D:\Inetpub\webs\k2club4wdcom\nuovomare\store.php on line 30
and I found out i didn't have the permission to write to that folder...even if i created that folder! anyway i worked it out, thank you very much!
I have another question though...what's more performing, uploading the file using ftp_put or using move_uploaded_file?