arvi_mca Posted May 30, 2008 Share Posted May 30, 2008 Hi everybody, i cant upload the file to server through the php coding even i check with the absolute path and relative file path for uploading. The same coding works well in other servers but not in one particular server give me a suggesstion whether it's a problem in server or anything i need to change in my server configuration. here i show the coding used for uploading the files <html> <body> <form action="upload.php" method="post" enctype="multipart/form-data"> <input type="file" name="userfile"/> <input type="submit" name="submit" value="submit"/> </form> </body> </html> php file uploading coding(Works well in other servers) <?php // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead // of $_FILES. $uploaddir = 'file_upload/here/'; //var/www/html/arvind/SERVER_INFO.php echo $uploadfile = $uploaddir.basename($_FILES['userfile']['name']); echo '<pre>'; if (move_uploaded_file($_FILES['userfile']['tmp_name'],$uploadfile)){ echo "File is valid, and was successfully uploaded.\n"; } else { echo "Possible file upload attack!\n"; } echo 'Here is some more debugging info:'; print_r($_FILES); print "</pre>"; ?> [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/107948-solved-file-uploading-to-servers-through-php/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.