How to detect if text file is uploaded ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
markthien
Forum Commoner
Posts: 33
Joined: Fri Feb 13, 2009 7:50 pm

How to detect if text file is uploaded ?

Post by markthien »

Hi guys,

I need to enable user to upload only text file to my server for processing. How can I detect if the file uploaded is a real text file and not other file like virus file. i guess user can rename a virus file to a text file.

thanks & regards,
Mark
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: How to detect if text file is uploaded ?

Post by pickle »

Maybe the Fileinfo extension?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply