Upload content more than one?

Posted by Community Admin on 03-Aug-2018 20:57

Upload content more than one?

All Replies

Posted by Community Admin on 04-Jan-2011 00:00

I have made my document library and want to upload two images (thumbnail and a large image). When I checkout my document and upload content and save changes, it appears only one image uploaded for that item.

using (var sf = App.Prepare().SetTransactionName("InsertTransaction").WorkWith())
            
                sf.Documents().GetManager().Provider.SuppressSecurityChecks = true;
                sf.Document().CreateNew().Do(item =>
                
                    item.Parent = sf.DocumentLibraries().Where(l => l.Title == PlayersModule.LibraryName).Get().FirstOrDefault();
                    item.Title = name;
                    item.UrlName = name + "_" + PlayersModule.LibraryName;
                    item.SetValue("Name", name);
                    item.SetValue("Country", country);
                    item.SetValue("HeightWeight", heightWeight);
                ).CheckOut().UploadContent(thumbnail.InputStream, thumbnail.GetExtension())
                                      .UploadContent(largeImage.InputStream, largeImage.GetExtension()).CheckInAndPublish();
            



I am assuming that last line should upload both files:

CheckOut().UploadContent(thumbnail.InputStream, thumbnail.GetExtension())                                      .UploadContent(largeImage.InputStream,largeImage.GetExtension()).CheckInAndPublish();

What is wrong over here?

Posted by Community Admin on 12-Jan-2011 00:00

Hi saadi,

Why you are uploading two image files at single document item?  What is the final purpose? 

Executing method "UploadContent" twice on one and the same document item will result in uploading the image files twice. As a result  the document item will contain the latest file you have uploaded.

You can upload the two image by calling  "CreateNew" method of Document facade.


All the best,
Milena
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed