1. Home
  2. Computing & Technology
  3. PHP / MySQL

Uploading Files with PHP

By Angela Bradley, About.com

3 of 6

Limit the File Size

if ($uploaded_size > 350000)
{
echo "Your file is too large.<br>";
$ok=0;
}
Assuming that you didn't change the form field in our HTML form (so it is still named uploaded), this will check to see the size of the file. If the file is larger than 350k, they are given a file too large error, and we set $ok to equal 0.

You can change this line to be a larger or smaller size if you wish by changing 350000 to a different number. Or if you don't care about file size, just leave these lines out.

3 of 6

Explore PHP / MySQL

More from About.com

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Advanced PHP
  5. PHP File Upload - PHP Upload Script - Upload file script

©2008 About.com, a part of The New York Times Company.

All rights reserved.