s-o-s Posted August 11, 2010 Share Posted August 11, 2010 Im trying to test a file upload to a remote server and getting nowhere, I have listed below a simple html form to collect the file for upload. The phpfile file is attached to do the upload. I have heard that the php.ini file needs to have a variable set currently upload_tmp_dir was set to NULL. I have changed this in a local copy of php.ini which I believe needs to be changed I am not familiar with the correct syntax for this but have included by version below also. The file format is root/site/test/ (php & html files) I want to upload the files to root/site/Uploads (If any other ini variables need to be changed - I have complete control over the website from root downwards) Please advise correct php.ini file settings html file html> <head> <title>File Upload Form</title> </head> <body> This form allows you to upload a file to the server.<br> <form action="getfile.php" method="post"><br> Type (or select) Filename: <input type="file" name="uploadFile"> <input type="hidden" name="MAX_FILE_SIZE" value="25000" /> <input type="submit" value="Upload File"> </form> </body> </html> getfile.php <html> <head> <title>Process Uploaded File</title> </head> <body> <?php if ( move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'], "site/Uploads/{$_FILES['uploadFile'] ['name']}") ) { print '<p> The file has been successfully uploaded </p>'; } else { switch ($_FILES['uploadFile'] ['error']) { case 1: print '<p> The file is bigger than this PHP installation allows</p>'; break; case 2: print '<p> The file is bigger than this form allows</p>'; break; case 3: print '<p> Only part of the file was uploaded</p>'; break; case 4: print '<p> No file was uploaded</p>'; break; } } ?> </body> </html> php.ini file ;PHP.ini file ; ;This file contains the changes I have assumed for the php.ini files. ;Temporary Upload File Location is been changed from NULL to allow for ;upload capability upload_tmp_dir=/site/Uploads ; Maximum allowed size for uploaded files. upload_max_filesize = 3M ;End. Thanks for your help! [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
trq Posted August 11, 2010 Share Posted August 11, 2010 /site/Uploads isn't a typical path. The first / stands for the root of the filesystem. Given these details, does /site/Uploads actually exist? This directory will also need to be writable by the user your server runs as. Quote Link to comment 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.