uploader in web control

  •  05-23-2008, 5:32 PM

    uploader in web control

    Hi,
     
    I'm having a problem when I try adding the uploader into my composite web control. All i'm doing is this..
     
    class ... 
    {
         private CuteWebUI.Uploader _FileUploadControl;
     
         protected override void CreateChildControls()
         {
             base.CreateChildControls();

             //new upload control
             if (!DisableUpload)
             {
                _FileUploadControl = new CuteWebUI.Uploader();
                _FileUploadControl.FileUploaded += new CuteWebUI.UploaderEventHandler(_FileUploadControl_FileUploaded);
                Controls.Add(_FileUploadControl);
             }
        }
     
    void _FileUploadControl_FileUploaded(object sender, CuteWebUI.UploaderEventArgs args)
          {
         
                try
                {
                   byte[] data = new byte[args.FileSize];
                   args.OpenStream().Read(data, 0, data.Length);

                   AFSFile file = new AFSFile(data, "FolderName", "", args.FileName)
                   file.Save();

    ...
     
         ...
    }
     
     
    The file data is uploaded successfully to the database using the code in the FileUploaded event. But for some reason I always get this error right after...
     
    The process cannot access the file 'FILE PATH' because it is being used by another process.
     
    Can anyone figure out a reason why?
     
    Thanks! :)

    Regards,

    Moe
View Complete Thread