Page 1 of 1

Displaying data in the "attachments" table

PostPosted: Wed Dec 31, 2008 2:37 pm
by dphizler
Now I have a new question.

I was looking at the database just now and well I wanted to try and display the data contained in the "attachments" table. Basically the content of files is stored in the database table in the "data" column. The data is somehow encoded. My problem is that I have no idea what method is used to encode the data. I've tried to decode it in Hexadecimal and base 64 but that hasn't given me what I want.

If anyone can help me, it would be greatly appreciated.

Thanks,

Phil

Re: Displaying data in the "attachments" table

PostPosted: Mon Jan 05, 2009 3:43 pm
by eliaslynch
They're stored in what's called a BLOB or Binary Large Object. See if this link might help you - http://support.microsoft.com/kb/173308

Re: Displaying data in the "attachments" table

PostPosted: Tue Jan 06, 2009 10:38 am
by dphizler
Thanks for the reply.

Yeah, I know. The datatype is the "image" datatype. You can store any type of file in that. I just have no idea how to display that file afterwards. I know it's encoded in base64 (or something like that) but after I've decoded it. I get some weird stuff and I have no idea how to go from there. I've tried everything that I can think of.

Your link is actually very help.

A new problem has revealed itself. For some odd reason files uploaded from the web portal and files attached through Alloy Navigator aren't stored the same way in the database. There seems to be another layer of encryption when the file is attached through Alloy Navigator. That certainly doesn't help.

Re: Displaying data in the "attachments" table

PostPosted: Thu Jan 08, 2009 11:57 am
by dphizler
I have all kinds of questions, but here is my latest question:

In the database table Attachments, there is a field called "Data".

So I attached the same file using the Web Portal and Alloy Navigator and the "Data" field ended up containing different data. So something different happens when you attach a file using Alloy Navigator and I'm currently a little lost.

Web Portal upload: 74657374696E67
Alloy Navigator upload: 21485A4C0700000000F8FFF17EBFAF98

The text contained in the file is "testing"

Using this website, the Web Portal upload is clearly encoded in Hexadecimal: http://www.string-functions.com/hex-string.aspx

So the real question is: What's different between when you upload a file using the Web Portal and when you use Alloy Navigator?

Thanks for your input

Re: Displaying data in the "attachments" table

PostPosted: Tue Jan 13, 2009 2:29 pm
by eliaslynch
dphizler wrote:So the real question is: What's different between when you upload a file using the Web Portal and when you use Alloy Navigator?


This is a bit beyond my skills so maybe someone else can chime in, but I wonder if it has something to do with compression. Maybe '74657374696E67' is simply not being compressed?

Re: Displaying data in the "attachments" table

PostPosted: Mon Jan 19, 2009 5:01 pm
by pille
Actually Elias is right. The Web Portal does not compress attachments, but the Main Console does. This is why the data looks differently.

Re: Displaying data in the "attachments" table

PostPosted: Wed Jan 21, 2009 7:48 pm
by eliaslynch
Oh my look at that :) I was right hehe

Woohoo! :shock:

Re: Displaying data in the "attachments" table

PostPosted: Fri Jun 17, 2011 12:40 am
by efrenlugo
It seems to be compressed, how could be descompressed? the header shows !HZL

Re: Displaying data in the "attachments" table

PostPosted: Fri Jun 17, 2011 6:02 am
by efrenlugo
It's possible to extract all the attachments from the database by using asp? I can extract the contents from the fields but this files are compressend in something couldn't be read.

Re: Displaying data in the "attachments" table

PostPosted: Tue May 29, 2012 10:58 am
by mike_ge
Hello to all,

I do a little update on this post, because as I can see, I wasn't the only one who got stuck by the compression of the attachments in the database of Alloy. After few hours I found a solution that can work using Windows or Linux.

As efrenlugo said, all the attachments start with a !HZL header, that can lead to a LZH algorithm compression. In fact it is really not far from the truth. The compression used by Alloy is the HNF algorithm, that more and less the same as the LZH (LH1) but with a different parameter. More information can be found here.

The tool to uncompress the datas is HNFTools Full and can be downloaded here.

In the zip file you will find a linux and a win32 directory, and in both of them you will have to use the executable/binary called hnf2fvt.

You will have to use it on a file, it means that you must extract all the attachment from your database and save them as file, and use the executable on the compressed extracted file. To retrieve the original filename, use the File_Name row from the Attachments table of Alloy.

Hoping that gonna help few of you and please excuse my english, it isn't my native language.

Mike.

Re: Displaying data in the "attachments" table

PostPosted: Fri Jun 29, 2012 1:35 pm
by janstonselig
Nice! :)