CanMan2004 Posted October 2, 2006 Share Posted October 2, 2006 Hi allJust a quick question really.Im looking for a very simple file upload script that will take files larger than 4MB, can anyone help? I've tried a few, but thought someone here might be able to help outRegardsMark Quote Link to comment Share on other sites More sharing options...
tomasz1 Posted October 2, 2006 Share Posted October 2, 2006 The size of the file allowable for upload can be set in the php.iniIf you have a script and it works on small files, then it is not the script that is the problem, often it is a result of default settings in php.ini. The ini file often needs to be configured for large files sizes, long execution times, and post size. All of these need to be tweaked so your large files can be processed.Also ensure that you have set MAX_FILE_SIZE in a hidden input preceding your file field(s). <input type="hidden" name="MAX_FILE_SIZE" value="4000000" ><!--max_file_size value in bytes. -->If you are experiencing ANY error messages when attempting to upload files it could be because: The webserver (as in the webserver process - not you as a user of the web application) does not have permission to write to the files directory(ies). The files directory under dotProject AND its associated subdirectories must have write permissions for the webserver process. You need to ensure that PHP has the following STANDARD PHP SETTINGS sorted out: file_uploads must be set to on post_max_size and upload_max_filesize must BOTH be set to the maximum file size you expectChange the above ini settings. Read: http://www.radinks.com/upload/config.php for more info on ini configurations. Test using http://ca.php.net/features.file-upload script example.Tomasz Quote Link to comment Share on other sites More sharing options...
ponsho Posted October 2, 2006 Share Posted October 2, 2006 You can set the max upload size creating a file in the root directory of your site just name it .htaccess and write this line inside itphp_value upload_max_filesize "20M" Quote Link to comment Share on other sites More sharing options...
CanMan2004 Posted October 2, 2006 Author Share Posted October 2, 2006 Hi allI've used the easiest of uploads scripts to try and get this working, the code I have used is;[code]<?phpif ($_POST['action'] = 'upload'){ $tmp_name = $_FILES["pictures"]["tmp_name"]; $name = $_FILES["pictures"]["name"]; move_uploaded_file($tmp_name, "data/$name");}?> <form action="" method="post" enctype="multipart/form-data"><p>Pictures:<input type="file" name="pictures" /><input type="hidden" name="action" value="upload" /><input type="submit" value="Send" /></p></form>[/code]When I load the page and try to upload a large file, after about 30 seconds, the browser seems to time out and reload the page again without uploading the file I selected, it seems to be okay for files under 600KB, but nothing larger, although, firefix seems to have more luck than Internet Explorer.To try and fix this, I took the last suggestion which was to add[code]php_value upload_max_filesize "20M"[/code]to a blank text file and saved it as[code].htaccess[/code]I then uploaded the file and ran the page again, this time, after around 30 seconds, it seems to displayThe page cannot be displayedIf I then refresh the page, I get the messageInternal Server Errorand cannot even upload small files.Previous to this, I tried adding[code]post_max_size=400000upload_max_filesize=400000max_execution_time=400000max_input_time=400000[/code]to a[code]php.ini[/code]file, but it didnt seem to effect anything.Can anyone give me any help or guidence?Thanks in advance for any helpEd Quote Link to comment Share on other sites More sharing options...
CanMan2004 Posted October 2, 2006 Author Share Posted October 2, 2006 If I check the error log, I get the following message[code][Mon Oct 2 13:05:29 2006] [alert] [client **.***.**.***] /home/theworks/public_html/cp/.htaccess: Invalid command 'php_value', perhaps mis-spelled or defined by a module not included in the server configuration[/code]Any ideas? I'm on a shared hosting account Quote Link to comment Share on other sites More sharing options...
CanMan2004 Posted October 2, 2006 Author Share Posted October 2, 2006 Any ideas anyone?If not, no worries, ill have to just put a limit on how much can be uploaded. 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.