1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Uploading Files with PHP


4 of 6

Limit Files by Type
 if ($uploaded_type =="text/php")
 echo "No PHP files<br>";
The code above checks to be sure the user is not uploading a PHP file to your site. If they do upload a PHP file, they are given an error, and $ok is set to 0.
 if (!($uploaded_type=="image/gif")) {
 echo "You may only upload GIF files.<br>";
In our second example we only allow users to upload .gif files, and all other types are given an error before setting $ok to 0. You can use these basic examples to allow or deny any specific file types.
Related Video
Upload Videos to Google Video
  1. About.com
  2. Technology
  3. PHP / MySQL
  4. Advanced PHP
  5. PHP File Upload - PHP Upload Script - Upload file script

©2014 About.com. All rights reserved.