I am making an application that allows users to upload a file in a directory via PHP.
I am having problems because it dose not allow me to overwrite files with the s
if (file_exists("documenti/$fileName"))
{
unlink("documenti/$fileName");
echo "<font face='Verdana' size='2' >Last Uploaded File has been removed from uploads folder<br>back to uploadform agian and upload your file<br>";// now your file which uploaded before was deleted from uploads folder you can open it and check if it removed or not , so no you should go back to uploadform again and import your file which will uploaded correctly
echo "<font face='Verdana' size='2' ><BR><BR><BR><a href='upform.php'>Back to upform</a><BR>";
}
Maybe the script does not have the rights to overwrite? Try to change the dir to 777 and test again. If it works then, you can figure out the correct value you need
Have you tried checking if the file exists and deleting it if it does before you move the temporary file to the permanent storage location?
Try this (put it before upload a file)
//checking if file exsists
if(file_exists("documenti/$fileName")) unlink("documenti/$fileName");
//Place it into your "uploads" folder mow using the move_uploaded_file() function
move_uploaded_file($fileTmpLoc, "documenti/$fileName");