Jump to content


This topic is now archived and is closed to further replies.


Uploading files

Recommended Posts

Hi all

Just 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 out



Share this post

Link to post
Share on other sites
The size of the file allowable for upload can be set in the php.ini

If 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 expect

Change 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.


Share this post

Link to post
Share on other sites
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 it

php_value upload_max_filesize "20M"

Share this post

Link to post
Share on other sites
Hi all

I've used the easiest of uploads scripts to try and get this working, the code I have used is;

if ($_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">
<input type="file" name="pictures" />
<input type="hidden" name="action" value="upload" />
<input type="submit" value="Send" />

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


I then uploaded the file and ran the page again, this time, after around 30 seconds, it seems to display

The page cannot be displayed

If I then refresh the page, I get the message

Internal Server Error

and cannot even upload small files.

Previous to this, I tried adding


to a


file, but it didnt seem to effect anything.

Can anyone give me any help or guidence?

Thanks in advance for any help


Share this post

Link to post
Share on other sites
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

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.