I have a URL format for CSV files that looks like this

http://www.domain.com/pathofinfo/compression/zip/

This allows an auto download of a zipped CSV file from the URL - however Parser CSV seems to be able to support this URL format?

Would it be possible?

CommentFileSizeAuthor
#6 mime-type.patch819 bytesburgs

Comments

alex_b’s picture

Version: 6.x-1.0-alpha1 » 6.x-1.x-dev
Category: support » task

Yes. Requires some coding.

We would have to be able to detect the format of the file other than by the suffix of the url. We could use PECL's fileinfo http://www.php.net/manual/en/ref.fileinfo.php or just try to do an unzip on the file and see whether we're successful. If we can't unzip, we assume a text file.

I prefer the latter approach because it does not require PECL.

jpetso’s picture

mime_content_type() is deprecated but always available (even without the fileinfo extension) so if it's enclosed in a function_exists('mime_content_type') it should be perfectly fine to use it in order to determine the mimetype.

parrottvision’s picture

thanks alex_b - happy to try and pull some money together to sponsor it if it can be added?

alex_b’s picture

#2 - I'm fine with function_exists('mime_content_type')

#3 - not money, but labor is scarce... : ) Could you get a developer on this? It's a small task.

parrottvision’s picture

burgs would you be up for it?

burgs’s picture

StatusFileSize
new819 bytes

Ok. want to try this?

alex_b’s picture

Status: Active » Needs review

#6: Is there any disadvantage in calling mime_content_type() on a remote file? Shouldn't we first download and then check for content type?

parrottvision’s picture

Would gzip work with this also?