why does it not work? i want to check whether the file I want to upload already exists.
<?php
if (isset($_POST['submit'])) {
$filename = $_POST['name'];
if(!file_exists('fileuploadsfolder/'.$filename)) {
move_uploaded_file($_FILES['file']['tmp_name'],'fileuploadsfolder/'.$_FILES['file']['name']);
header("Location:../");
}else{
echo "File already exists";
}
}
?>
here is an excerpt from my index file.
<form action="fileupload.php" method="POST" enctype="multipart/form-data">
<input type="file" name="name">
<button type="submit" name="submit">Upload</button>
</form>