GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 3.50 average.
  #1  
Old 02-Jan-2003, 07:58
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough

VALIDATING file types on an PHP upload script?


I was working on an uploading process off a script I am writing and got stuck trying to validate the uploaded file type.

The script is supposed to only accept .gif, .jpg and .png files. I thought it would be simple just checking the $_FILES['file']['type'] value but was shocked to find that it's browser-dependent! So I checked 3 popular browsers: Opera, MSIE and Mozilla and so far this is what I collected:
PHP Code:

$up->SetSupportedFiles(
  array(
    'image/gif',   // Opera, Moz, MSIE
    'image/jpeg',  // Opera, Moz
    'image/png',   // Opera, Moz
    'image/pjpeg', // MSIE
    'image/x-png'  // MSIE
  )
); 


Is there any other SIMPLER way to get this done without having to manually collect a list like this?
 
 

Recent GIDBlog2nd Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP script to show last referrer url and top referrer to your site jrobbio MySQL / PHP Forum 6 22-May-2006 01:06
[script] Password Protect web pages/site using PHP and MySQL JdS PHP Code Library 0 23-Jul-2003 10:02
All the big PHP script collections that matter jrobbio MySQL / PHP Forum 5 06-Jun-2003 16:14
How Do i get php to find out the file type of a file for me? viperman95833 MySQL / PHP Forum 2 08-Mar-2003 09:48
PHP Script pcxgamer MySQL / PHP Forum 6 10-Jan-2003 06:52

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 06:41.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.