PDA

View Full Version : upload error


red_rose
01-20-2007, 07:12 PM
hie,

i have a code to upload a file to the server. but whenever i run it, insert the data n upload it, i get this error :

Warning: mkdir() [<function.mkdir>]: File exists in :\Inetpub\wwwroot\Demo.php on line 19

although i get this error, the file is still uploaded, i have checked it. that's why i don't know why am i getting this error. below is the code, can anyone help me on this?

thanks


<?php

if(@$_REQUEST['Mode']=="Save")
{
$Nm=$_REQUEST['Nm'];
$Addr=$_REQUEST['Address'];
if ($Nm !="" && $Addr!="" && $HTTP_POST_FILES['Fle']['name'] != "")
{
if(!(is_dir("Image_upload_Folder")))
{
mkdir("C:\Image_upload_Folder");
}
copy($HTTP_POST_FILES['Fle']['tmp_name'],"/Image_upload_Folder/".$HTTP_POST_FILES['Fle']['name']);
$Pict=$HTTP_POST_FILES['Fle']['name'];
$Sql="insert into `images_table` (`ID`,`name`,`Address`,`File_Name`) values(NULL, '".$Nm."','".$Addr."','".$Pict."')";
$result = mysql_query($Sql);
$row = @mysql_fetch_array($result);
}
}
?>

<form name=frm1 method=post action="Demo.php?Mode=Save" enctype="multipart/form-data" onSubmit="return FnChk()">
<table>

<tr><td>Name :</td><td><input type=text name=Nm></td></tr>
<tr><td>Address :</td><td><textarea name=Address cols=20 rows=10></textarea></td></tr>
<tr><td colspan=2 align=center><input type=file name=Fle></td></tr>
<tr><td colspan=2 align=center><input type=submit name=Submit value=Submit></td></tr>

</table>
</form>

davidj
01-20-2007, 08:11 PM
where you have


if(!(is_dir("Image_upload_Folder")))
{
mkdir("C:\Image_upload_Folder");
}

try this


if(!(is_dir("C:\Image_upload_Folder")))
{
mkdir("C:\Image_upload_Folder");
}


remember that if this was to become a live application you will not be allowed to use C:/ to create directories. You should create these within your web root