ASPX templates
Version 3.x > ASPX templates > Getting file information from attachement View modes: 
User avatar
Member
Member
elp@gmx.at - 7/16/2008 1:13:45 AM
   
Getting file information from attachement
hi,

i'm using kentico image form control in a customized application to add files from the kentico CMS to data objects - i can select the file from the file dialogue and save the path in the database, using kenticos ImageSelector Control.

My question: i do have the path / file information for the selected file in my database, which is inserted by the dialogue and saved as a string (like "/GUID/GetFile/MyFile.aspx") - what i would need, is to get the file information like extension, size etc... from this path. I tried it with AttachementHelper, but there is always a NodeID necessary... Any hints?

thanks
elmar

User avatar
Kentico Developer
Kentico Developer
kentico_zbysekn - 7/29/2008 7:31:13 AM
   
RE:Getting file information from attachement
Hello,
If you have guid,you can simply use code like this:

CMS.FileManager.AttachmentManager am = new CMS.FileManager.AttachmentManager();
CMS.FileManager.AttachmentInfo ai = am.GetAttachmentInfo(AttachmentGuid, "Site name");

At last you can access ai properties like MIMEtype,etc.

Best Regards,
Zbysek Nemec.