Im using this function to try and upload some files, it keeps thinking that the file already exists, when it clearly doesnt. It worked for a while, then stopped, did i kill it somehow?
any and all help greatly appreciated.
mike
//this uploads files to the nz slick directory
function fileUpload($img,$img_name,$img_size,$abpath)
{
//user defined variables
// $abpath is absolute path to where images are uploaded.
$sizelim = "no"; //Do you want size limit, yes or no
$size = "60000"; //What do you want size limited to be if there is one
if($debug==1){echo"Path=$abpath<br>URL:$url<p>Image:$img<p>Image_name: $img_name<p>";}
//checks if file was selected to upload
if ($img == 'none') {
die("<b>Error:</b> No image selected.");
}
if ($sizelim == "yes") {
if ($img_size > $size) {
die("<b>Error</b> The file you are trying to upload must be $size or smaller");
}
}
//checks if file existes
if (file_exists("$abpath/$img_name")) {
echo"Path:$abpath<br>img_name=$img_name";
die("<b>Error:</b> File Already Exists, please rename go back and rename file.");
}
@copy("$img", "$abpath/$img_name") or die("<b>Error:</b> Directory Not Created or chmod correctly");
echo"Image Successfully Uploaded<br>";
}