Hi All,
here’s a part of my script which suppose to upload the new .pdf file in case it doesn’t exists on the server AND replace the existing one with the new one in case it exists on the server. It is working fine on one of my online sites but returns a warning and doesn’t replace the existing file on my local machine in a new project…
Here’s the script :
if(move_uploaded_file($_FILES['filename']['tmp_name'], $resumes_dir)) {
if(@file_exists("../__data/users/resume/".$filename)){
rename("../__data/users/resume/".$filename, "../__data/users/resume/".$hashedfilename);
$q_resume_insert = "UPDATE users_details SET
resume = '$hashedfilename'
WHERE username = '$user_name'";
if (mysql_query($q_resume_insert)) {
$upload_success = true;
}// end if mysql_query
}
else{
$errorList[] = "There was an error uploading the file, please try again!";
}
} else{
$errorList[] = "There was an error uploading the file!";
}
}
else {
$errorList[] = "File Upload Failed!<br />";
}
and it returns warning :
Warning: rename(../__data/users/resume/leanyvasar_leporello.pdf,../__data/users/resume/halapala.pdf) [function.rename]: File exists in C:\\Xampp\\htdocs\\my_site\\ajax\\ajaxupload.php on line 570
the 570th line is :
rename("../__data/users/resume/".$filename, "../__data/users/resume/".$hashedfilename);
I can’t figure out why it is working online and does not locally??? May be a server issue?
Thank you advanced.