Jump to content


Uploading files

  • Please log in to reply
5 replies to this topic

#1 CanMan2004

  • Members
  • PipPipPip
  • Advanced Member
  • 254 posts

Posted 02 October 2006 - 12:27 AM

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



#2 tomasz1

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 02 October 2006 - 06:04 AM

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.c...load/config.php for more info on ini configurations. Test using http://ca.php.net/features.file-upload script example.


#3 ponsho

  • Members
  • PipPip
  • Member
  • 24 posts

Posted 02 October 2006 - 06:28 AM

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"

#4 CanMan2004

  • Members
  • PipPipPip
  • Advanced Member
  • 254 posts

Posted 02 October 2006 - 11:43 AM

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

php_value upload_max_filesize "20M"

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


#5 CanMan2004

  • Members
  • PipPipPip
  • Advanced Member
  • 254 posts

Posted 02 October 2006 - 12:07 PM

If I check the error log, I get the following message

[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

Any ideas? I'm on a shared hosting account

#6 CanMan2004

  • Members
  • PipPipPip
  • Advanced Member
  • 254 posts

Posted 02 October 2006 - 01:44 PM

Any ideas anyone?

If not, no worries, ill have to just put a limit on how much can be uploaded.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users