Hello every one i have the following code works in local host but it doesnt in the server <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form enctype="multipart/form-data" action="upload_rename_ac.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="100000000000000000000" /> Choose a file to upload: <input name="uploaded_file" type="file" /><input type="submit" value="Upload" /> </form> The script (upload.php): <?php //Check that we have a file 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); //Determine the path to which we want to save this file $newname = dirname(__FILE__).'/file/'.$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))) { echo "It's done! The file has been saved as: ".$newname; } else { echo "Error: A problem occurred during file upload!"; } } else { echo "Error: File ".$_FILES["uploaded_file"]["name"]." already exists."; } } else { echo "Error: No file uploaded"; } ?> </body> </html> Code (markup): and i give the permission to server folder to be 777 any suggestion?
there is no error there is no warning but the images didn't upload in the folder!!! should i do something in the server to make it work?? Thanks
You should set up .htaccess to not inhibit the errors. Other way is to echo some debug info like $newname;
Create a file in the root of your script: .htaccess Add these line into that: php_value display_errors 1 php_value error_reporting 2039 Code (markup):
I did that but i didnt receive any errors or warnings !!! hint: my folder to save pics is not the folder which includes uploadImages.php in other words my there is folder1 which inclide folder"uploaded images" and folder"files" which contain .php files , is that the reason to didnt receive any errors!!