Digrev Posted September 6, 2010 Share Posted September 6, 2010 Hi everybody i have two problems with my code first one i cant upload .png files to the img folder (no problem with the other extensions ) the other one "if file exist" part doesnt work i dont get the message "File alredy exist" after uploading second time Can you help plase <form action="upload.php" method="post" enctype="multipart/form-data"> <input name="dosya" type="file"> <input name="submit" type="submit" value="Gonder"> </form> <?php $kaynak=$_FILES["dosya"]["tmp_name"]; $ad=$_FILES["dosya"]["name"]; $tur=$_FILES["dosya"]["type"]; $boyut=$_FILES["dosya"]["size"]; $hedef="./img"; if($tur == "image/jpeg" || $tur == "image/png" || $tur == "image/pjpeg" ) { if(!file_exists($ad)) { move_uploaded_file($kaynak,$hedef.'/'.$ad); echo "ok"; } else echo "File already exist"; } ?> Link to comment https://forums.phpfreaks.com/topic/212711-uploading-errors/ Share on other sites More sharing options...
Digrev Posted September 6, 2010 Author Share Posted September 6, 2010 Please guys whats wrong with this code Link to comment https://forums.phpfreaks.com/topic/212711-uploading-errors/#findComment-1108050 Share on other sites More sharing options...
Hypnos Posted September 7, 2010 Share Posted September 7, 2010 You script moves the image to ./img, but your file_exists() doesn't look in there. Link to comment https://forums.phpfreaks.com/topic/212711-uploading-errors/#findComment-1108063 Share on other sites More sharing options...
Digrev Posted September 7, 2010 Author Share Posted September 7, 2010 Hi my script moves thats right but the problem png files did you try to upload any png files ? Link to comment https://forums.phpfreaks.com/topic/212711-uploading-errors/#findComment-1108206 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.