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"; } ?> Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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 ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.