hi i have a php script for upload images that’s working on my website but if i work on the local host it dosen’t work.The script tell me success but the uploads folder is empty. all is store in htdocs.
i hope somebody can help me.
thank you!!!
`<?php
if (isset($_POST[‘submit’])) {
$file = $_FILES[“file”];
$fileName = $_FILES["file"]["name"];
$fileTmpName = $_FILES["file"]["tmp_name"];
$fileSize = $_FILES["file"]["size"];
$fileError = $_FILES["file"]["error"];
$fileType = $_FILES["file"]["type"];
$fileExt = explode('.', $fileName);
$fileActualExt = strtolower(end($fileExt));
$allowed = array('jpg','jpeg','png','gif' );
if (in_array($fileActualExt, $allowed)) {
if ($fileError === 0) {
if ($fileSize < 500000) {
$fileNameNew = uniqid('', true).".".$fileActualExt;
$fileDestination = 'uploads/'.$fileNameNew;
move_uploaded_file($fileTmpName, $fileDestination);
header("Location: ../index.php?uploadsuccess");
} else {
echo "Your file is too big!";
}
} else {
echo "There was an error uploading your file!";
}
} else {
echo "You ca not upload files of this type!";
}
}`