So I have a upload system whereby there is a simple upload button. The upload works fine and uploads into a directory which is designated for it on the server. However move_uploaded_file does not work. Everytime i upload it does not replace the existing file and simply ignores it.
<?php
$fn = "uploads/firstImage/";
$content = ($_POST['content']);
$fp = fopen($fn,"w") or die ("Error opening file!");
fputs($fp, $content);
fclose($fp) or die ("Error closing file!");
echo "<meta http-equiv=\"refresh\" content=\"0; url=changed.php\"/> \n";
?>
Seperate php file when uploading:
<?php
$target = "uploads/firstImage/";
$target = $target . $_FILES['uploaded']['name'];
if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file '$target' has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file" ; }
?>
Any help would be appreciated.