<?php
$filedname = 'albumart';
if (isset($_FILES[$filedname]['name'])) {
$fileName = $_FILES[$filedname]['name'];
$fileTmpLoc = $_FILES[$filedname]['tmp_name'];
$fileSize = $_FILES[$filedname]['size'];
$fileType = $_FILES[$filedname]['type'];
$fileErrMsg = $_FILES[$filedname]['error'];
$allowed = array(
'gif',
'png',
'jpg',
'jpeg'
);
$ext = pathinfo($fileName, PATHINFO_EXTENSION);
if ($fileSize > 50000) {
if (!in_array($ext, $allowed)) {
echo 'Sorry, only JPG, JPEG, PNG & GIF files are allowed.';
} else {
$dir = "upload";
if (move_uploaded_file($fileTmpLoc, "$dir/$fileName")) {
$path = "upload/$fileName";
echo $path;
} else
echo "Folder is there, but file not uploaded some error";
}
} else {
echo "Invalid size";
}
} else {
echo "File Upload Error";
}
?>
0 comments:
Post a Comment