ASPX templates
Version 5.x > ASPX templates > Trying to Use API as Demo View modes: 
User avatar
Member
Member
info@syncworx.com - 9/24/2010 3:23:17 AM
   
Trying to Use API as Demo
Hello Guys,

We are evaluating the API Library of Kentico and we are trying to upload Attachments using custom code. We marked on the Site Manager to Save all Files on Physical Disk instead of Database. The Code we are using to upload the attachment is as following:

// Create the attachment manager
AttachmentManager am = new AttachmentManager(tp.Connection);
// Create the attachment
Guid attachmentGuid = Guid.NewGuid();
AttachmentInfo ai = new AttachmentInfo("D:\\C-ICLW1733.jpg", node.DocumentID, attachmentGuid, tp.Connection);
am.SetAttachmentInfo(ai);
// Set the attachment reference
node.SetValue("BookFImage", attachmentGuid);
node.Update();

The code is working but it is not saving the attachment physically on the Upload Folder.

Please advice.

Regards,

User avatar
Kentico Support
Kentico Support
kentico_radekm - 10/18/2010 4:14:17 AM
   
RE:Trying to Use API as Demo
Hello.

I checked source code of these methods and it should save your data to file system as well. Can you confirm that your have "Store files in file system" checked for particular site, not globally only?

What is saved into database when you run this code? Only file info (record about new file without binary data), or with binary data as well? Thank you.

Best Regards,
Radek Macalik