More in this section

Forums / General Discussions / Upload content more than one?

Upload content more than one?

2 posts, 0 answered
  1. Saad
    Saad avatar
    98 posts
    10 Oct 2008
    04 Jan 2011
    Link to this post
    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?
  2. Milena
    Milena avatar
    75 posts
    27 Sep 2017
    12 Jan 2011
    Link to this post
    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,
    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
2 posts, 0 answered