Reputation: 25
I am making a website using profile picture uploader in the beginning i thought it was working great but yesterday i photographed some photos with my Camera which is a Sony DSC-h400 and it has 20MegaPixels in image quality after that i tried to upload it to my localhost website using PHP uploading script,well it didn't work and then i tried with the w3schools.com PHP Upload Script but it always give me this error :
Warning: getimagesize(): Filename cannot be empty in D:\xampp\htdocs\tests\upload_img_w3c\upload.php on line 8
File is not an image.Sorry, only JPG, JPEG, PNG & GIF files are allowed.Sorry, your file was not uploaded.
NOTE : I tried with the low quality .jpeg .jpg images (133Ko) But not working either,and i searched in google for an error similar to this but it looks like I'm the only one.
NOTE 2 : The high quality image size was 6.44 MB.
I would appreciate any help even if it's not working.
Upvotes: 2
Views: 2142
Reputation: 321
Have you checked the upload_max_filesize
? It needs to be changed to allow bigger file uploads.
See this thread: Changing upload_max_filesize on PHP
Upvotes: 1
Reputation: 804
<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg")
|| ($_FILES["file"]["type"] == "image/jpg"))
&& ($_FILES["file"]["size"] < 2000000)) // set yourimg size ..
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
if (file_exists("upload/temple/" . $_FILES["file"]["name"]))
{
}
else
{
chmod("upload/temple/",0777);
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload//temple/" . $_FILES["file"]["name"]);
//copy("upload/".$FILES["file"]["name"]);
echo "Stored in: " . "upload/temple/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
?>
Upvotes: 0