I am using a csv file and adding all products to the kentico database with the help of DocumentHelper methods.Below is the code which I used while adding products to Kentico database in Kentico 9.0. This works finepublic void InsertAttachment(string url, SKUTreeNode productDoc)
{
string file = DownloadImage(url);
if (!String.IsNullOrEmpty(file))
{
Bitmap bmp = (Bitmap)System.Drawing.Image.FromFile(Server.MapPath(file), true);
AttachmentInfo attachment = DocumentHelper.AddAttachment(productDoc, "ProductImage", file, tree);
attachment.AttachmentImageHeight = getRelativeHeight(bmp);
attachment.AttachmentImageWidth = 300;
attachment.AttachmentIsUnsorted = true;
AttachmentInfoProvider.SetAttachmentInfo(attachment);
productDoc.Update();
}
}
Same code I use for Kentico 10 but I get an error in the AddAttachment method.It is not accepting the TreeProvider variable “tree”.
Can you please provide me the solution for this or an alternate way through which I might add an attachment ?
↧