Hello i have a problem with my script for uploading a photo. The name it is stored in the database (123.jpg) but the photo doesnt go to folder i ask it to go
Here is my script
<form id="imageform" method="post" enctype="multipart/form-data" action='<?php echo $base_url; ?>press_image_ajax.php'> <span id='addphoto'><?php echo $lang['AddAPicture'];?>:</span> <input type="file" name="photopress" id="photopress" /> </form>
and the press_image_ajax.php
<?php
$target_dir = "http://localhost/Last/uploads/";
$target_file = $target_dir . basename($_FILES["photopress"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
$uploadOk = 0;
}
if (move_uploaded_file($_FILES["photopress"]["tmp_name"], $target_file))
{
echo "The file ". basename( $_FILES["photopress"]["name"]). " has been uploaded.";
}
else
{
echo "Sorry, there was an error uploading your file.";
}
?>