perl.beginners.cgi
[Top] [All Lists]

Re: Determine upload file type

Subject: Re: Determine upload file type
From: noreply@xxxxxxxxx (Gunnar Hjalmarsson)
Date: Sat, 21 Jun 2008 00:14:19 +0200
Newsgroups: perl.beginners.cgi


Mimi Cafe wrote:
I need to write a cgi program to enable our users to upload files using the
web browser,

Okay. As Owen mentioned, the module CGI::UploadEasy may be helpful.

but I am not sure how to figure out the type of file the user
wants to upload (e.g text or binary file). Can CGI.pm accomplish this
automatically?

If you need that information before a file is uploaded, the answer is no. CGI.pm (and, consequently, CGI::UploadEasy) does provide MIME type based on the file extension and browser settings _after_ the files have been uploaded, but note that that info is not a reliable way to determine e.g. text or binary.

What's the purpose of your desire to know the file type?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

<Prev in Thread] Current Thread [Next in Thread>