Forum Moderators: coopster
<input Name "filename"
<input name="filename"
<?php
if (!defined('ROOT')) {
define('ROOT', rtrim($_SERVER['DOCUMENT_ROOT'], '/')); //the rtrim is to ensure no slash at end (different server setups may/may not have it)
}
//Assign the entered filename to a variable
$filename = $_POST[filename];
//Specify the upload directory - assign to a variable
$uploaddir = ROOT.'/images';
//Append the filename to the end of the upload directory
$uploadfile = $uploaddir.'/'.$filename; //note the slash '/' needed here between the directory name and file name
//If upload is successful, print confirmation message
if (move_uploaded_file($_FILES['propertyimage']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.<br>";
echo "Its name is <a href=$filename>$filename</a>";
} else {
echo "There was an error.";
}
?>
$_POST[filename];