Jump to content

Uploading errors


Digrev

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.