I have a form element used to browse for and upload a file. The snippet is:
<input type="file" name="file">
And here's the php that processes it:
$target_path = "../propimages/listingPhotos/";
$tmp_name = $_FILES['file']['tmp_name'];
$name = $_FILES['file']['name'];
if(!move_uploaded_file($tmp_name, "$target_path$name")){
if(!is_writable($target_path)){
echo "path not writable<br />";
}
echo "Could not upload the file<br />";
echo "$target_path$name<br />";
echo $target_path."<br />";
exit();
}else{
$listingPhoto = "$target_path$name";
}
I've ensured the correct security permissions and have even used this script (with different variables) on other projects without a hitch. The problem is it doesn't upload the file and doesn't seem to get the filename for that matter. Where I have it echo the $target_path$name and the $target_path separately, only the path is echoed. Do I need to concatenate the variables to be $target_path.$name ?
TIA!