Gossamer Forum
Quote Reply
Mime Type in GT::CGI
Is it possible to extract the mime type of a multipart upload?

It would make sense to use the uploaded mime type as the default, then change it if upon processing the upload, a better determination was made.



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Plugins:http://LinkSQL.com/plugin
Quote Reply
Re: Mime Type in GT::CGI In reply to
Hi,

No, currently GT::CGI parses this, but doesn't save it or make it available. That said, you will be much better of going off the extension then the type the browser suggested.

I worked on a document management system that had to handle Word Files, PDF's, Rich Text Formats, etc. I started using the content type the browser had sent, but it was different for different browsers, and different versions of browsers. I ended up just using the extension.

If there's no extension, just save the file, and if it passes -T $filename, then it's a text/plain type, otherwise it's an application/octet-stream type.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Mime Type in GT::CGI In reply to
Ok... I think most files using this will be either text or an identified graphic. At least at first. I still have to scour CPAN for type-identification code for other types.



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Plugins:http://LinkSQL.com/plugin
Quote Reply
Re: Mime Type in GT::CGI In reply to
Hi,

You may want to look at GT::MIMETypes, we have a pretty complete list, and functions that can go from filename => mime type. I don't think it's in Links SQL, but is in Gossamer Mail 2.

Cheers,

Alex

--
Gossamer Threads Inc.