Gossamer Forum
Home : General : Perl Programming :

Help me(File Format)

Quote Reply
Help me(File Format)
how to know what format a file is ,for example aaa.bbb(gif,jpg,HTML,txt etc)
Quote Reply
Re: Help me(File Format) In reply to
What are you going to use this for, makes it allot easier to figure out?

------------------
Quote Reply
Re: Help me(File Format) In reply to
I need to judge a file's format, because the file is uploaded by users, while i must forbid any format, such as GIF animation files.
Quote Reply
Re: Help me(File Format) In reply to
 
Quote:
i must forbid any format, such as GIF animation files.

The problem you are going to run into is that there is no way to know whether you have an animated gif or a non-animated gif until after the file has been uploaded. You can't tell during the uploading; the only thing you can do is check for the file's extension (as covered in the thread you started on this same subject at http://www.gossamer-threads.com/...um8/HTML/000376.html ).

Once the file is uploaded, you should be able to ascertain its contents but I am not sure how to go about that.