Read .MHT file using Coldfusion

Hi,

I have a .mht file through an interface which I want to read through using Cold Fusion Code.

I have been trying to change it into excel to read it but it is not solving the purpose. I have been searching this over but haven’t got any thing concrete for now.

Any pointers would be appreciated.

Thanks!

Hi Ritika,

Is it this kind of file? http://en.wikipedia.org/wiki/MHTML

What are you wanting to do with the file once you “read” it?

Looking around the Internet, there appear to be several Java-based libraries you can probalby use:
http://www.software112.com/products/chilkat-java-mht-library.html

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Hi Ritika,

You can read file in coldfusion -> fileRead() function, I would suggest to have look ColdFusion file functions
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_e-g_13.html#5177516

Thanks

First it is not Cold Fusion unless you are using Cold Fusion 4 or lower, secondly as it is only an extension then it will be up to the browser to read it and do what it needs it to do.

As this format is an archive format, my recommendation would be to convert them on the fly to maybe PDF and server them this way.

But a Google search on how to convert an mht file to a pdf returns great articles.

Hi Brad,

Yes its the MHTML file.
It is a report wilt few rows and columns and I have to read the file to import that data in to the Database.

Thanks!

Sounds like you need to write a parser to do this, have you got an example of the XML involved in it?

MHTML isn’t XML, it’s a multi-part MIME file much like the raw source of an E-mail. It has header, then content type boundaries. That’s how it stores an entire web page includes images and such in a single file. There are Java libraries for parsing those files like the one I linked to that will unpack the HTML and images for you.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com