Check the settings in php.ini
file:
upload_max_filesize
post_max_size
If max sizes are too small then files will not be uploaded. Increase the size and see if it solves your problem.
Vra
I have this part of code, and I tried few things like "or" and "else" but it didn't work correctly for me. So atm it works for .jpg file format, and uploads it fine, when I tried to add .gif with limitation of 1-2mb it didn't upload it. Can you help?
if (($ext == "jpg") && ($_FILES["uploaded_file"]["type"] == "image/jpeg") && ($_FILES["uploaded_file"]["size"] < 350000))
I used
if (($ext == "gif") && ($_FILES["uploaded_file"]["type"] == "image/gif") && ($_FILES["uploaded_file"]["size"] < 2000000))
for gifs and
if (($ext == "png") && ($_FILES["uploaded_file"]["type"] == "image/png") && ($_FILES["uploaded_file"]["size"] < 1000000))
but it didn't work, so if someone can help me out please =)
Full part of that code for just jpeg was:
if((!empty($_FILES["uploaded_file"])) && ($_FILES['uploaded_file']['error'] == 0)) {
//Check if the file is JPEG image and it's size is less than 350Kb
$filename = basename($_FILES['uploaded_file']['name']);
$ext = substr($filename, strrpos($filename, '.') + 1);
if (($ext == "jpg") && ($_FILES["uploaded_file"]["type"] == "image/jpeg") && ($_FILES["uploaded_file"]["size"] < 350000)){
//Determine the path to which we want to save this file
$newname = dirname(__FILE__).'/upimg/'.$filename;
//Check if the file with the same name is already exists on the server
if (!file_exists($newname)) {
//Attempt to move the uploaded file to it's new place
if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) {
Oplossing
Check the settings in php.ini
file:
upload_max_filesize
post_max_size
If max sizes are too small then files will not be uploaded. Increase the size and see if it solves your problem.