Two copies of a file gets uploaded

Last post 08-26-2009, 7:54 PM by cutechat. 1 replies.
Sort Posts: Previous Next
  •  08-26-2009, 2:08 PM 55079

    Two copies of a file gets uploaded

    Hi,
    I have a file upload event handler,
     void Uploader_FileUploaded(object sender, UploaderEventArgs args)
        {
            if (GetVisibleItemCount() >= 3)
                return;
            using (System.IO.Stream stream = args.OpenStream())
            {
                Attachments1.Upload(args.FileSize, args.FileName, stream);
            }
        }
    Web.Config has the following settings:
    <add key="CuteWebUI.AjaxUploader.TempDirectory" value="D:\UploadedFiles\"/>
     
    When I upload a file, two  copies of resx files are generated (with different names). On deleting through Attachement.DeleteAllAttachments(), only one copy gets deleted and other still remains in the directory. How can I get rid of this issue?
  •  08-26-2009, 7:54 PM 55081 in reply to 55079

    Re: Two copies of a file gets uploaded

    hi,
     
    you have two solution :
     
    1 , call args.Delete(); after pass the stream to Attachments1
     
    2 , use Attachments1.Upload(args.FileSize, args.FileName, args.GetTempFilePath()) , the file will move from Uploader to Attachments1
     
    Regards,
    Terry
     
View as RSS news feed in XML