On Sat, 16 Jan 2010 19:37:36 +0100 Marcin 'Rambo' Roguski <rambo@xxxxxxxxxxxx> wrote: <snip> > What about temporary files? Are they uploaded or not? > From what you're writing, neither size or type are > identified (should be set after a successful completion > of POST request). > > Can you add > > print_r($GLOBALS['HTTP_POST_FILES']['profile_image']) > > in the function? </snip> Dear all, I know it is offtopic to discuss php in apache list, but I might be permitted to share my findings with you all which is very interesting. I know nothing about php but I tried to upload file in the same server with a different code collected from net. And this time the upload is working !!! Not only in debian server but in the suse server too :-) Still the question is why the previous code works on debian and not on suse. both the codes are given at button debian serevr -------------- Apache/2.2.9 (Debian) PHP 5.2.6-1+lenny4 with Suhosin-Patch 0.9.6.2 suse server ------------------- apache2-2.2.10-2.5 PHP 5.2.6 with Suhosin-Patch 0.9.6.2 new php code for uploading ( collected from net ) ( running on both debian & suse server ) ` ` ` <?php // Configuration - Your Options $allowed_filetypes = array('.jpg','.gif','.bmp','.png'); // These will be the types of file that will pass the validation. $max_filesize = 524288; // Maximum filesize in BYTES (currently 0.5MB). $upload_path = './upload/'; // The place the files will be uploaded to (currently a 'files' di rectory). $filename = $_FILES['userfile']['name']; // Get the name of the file (including file extension). $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); // Get the extension from t he filename. // Check if the filetype is allowed, if not DIE and inform the user. if(!in_array($ext,$allowed_filetypes)) die('The file you attempted to upload is not allowed.'); // Now check the filesize, if it is too large then DIE and inform the user. if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize) die('The file you attempted to upload is too large.'); // Check if we can upload to the specified path, if not DIE and inform the user. if(!is_writable($upload_path)) die('You cannot upload to the specified directory, please CHMOD it to 777.'); // Upload the file to your specified path. if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename)) echo 'Your file upload was successful, view the file <a href="' . $upload_path . $filename . '" title="Your File">here</a>'; // It worked. else echo 'There was an error during the file upload. Please try again.'; // It failed :(. ?> ` ` ` and here is the old one ( running on debian lenny server only ) ` ` ` function fileUploder(){ $upload_file_path = 'fileadmin/user_upload/images/profile/'; $file_size = 1000000; $file_type_list= Array('image/png','image/jpeg','image/gif','application/octet-stream') $upload_flag = false; $msg = ''; $target_path = ''; // Check the file parameters $upload_file_type = $GLOBALS['HTTP_POST_FILES']['profile_image']['type']; if(in_array($upload_file_type, $file_type_list)) { // file type is ok if($GLOBALS['HTTP_POST_FILES']['profile_image']['size'] < $file_size) $upload_flag = true; else $msg = 'Over size file'; } else $msg = 'Not an Image file'; ` ` ` Thanks --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx