上传多个文件时,目标引用未设置为错误

时间:2013-05-20 14:13:31

标签: c# asp.net sharepoint

当我在sharepoint上传大量文件时,我收到错误

  

对象引用未设置为..

这是代码,

public override void ItemAdding(SPItemEventProperties properties)
        {
            try
            {
                this.DisableEventFiring();

    HttpFileCollection collection = _context.Request.Files; //HERE I GET ERROR sir


    for (int i = 0; i < collection.Count; i++)
    {
        HttpPostedFile postedFile = collection[i];

        Stream fileStream = postedFile.InputStream;
        fileStream.Position = 0;
        byte[] fileContents = new byte[postedFile.ContentLength];
        fileStream.Read(fileContents, 0, postedFile.ContentLength);

        System.Drawing.Image image = System.Drawing.Image.FromStream(new System.IO.MemoryStream(fileContents));
当我尝试上传多个图片时,它会打开微软文件管理器,也许这就是为什么上下文为空?

0 个答案:

没有答案