Duplicates Uploaded files

Last post 02-05-2009, 1:25 AM by jberney22. 4 replies.
Sort Posts: Previous Next
  •  02-03-2009, 5:27 PM 48329

    Duplicates Uploaded files

    Hi,

     I'm having a problem...I get duplicates upload when I do the following.

    First I upload  documents once they show on the grid..I upload another document. The problem is when I upload for the second time..it adds the original  documents that i've already added plus the new add file. Is there a solution to this? Here my code...
     
     
    <CuteWebUI:Uploader ID="Uploader2" runat="server" MultipleFilesUpload="true"
                                  
                                              onfileuploaded="Uploader2_FileUploaded" >
                                                                            <VALIDATEOPTION AllowedFileExtensions="jpeg, jpg" MaxSizeKB="102400" />
                                                                           
                                                                        </CuteWebUI:Uploader>


    here the event..

     protected void Uploader2_FileUploaded(object sender, UploaderEventArgs args)
        {
            GridView2.Dispose();
            string newname = "myfile." + args.FileGuid + "." + args.FileName + ".resx";
            Photo ph = new Photo();
            ph.PhotoGuid = args.FileGuid;
            ph.PhotoName = args.FileName;
            ph.PhotoTempName = newname;
            ph.AccidentID = 0;



            int exec = AccidentDAO.AddPhoto(ph);
        
            args.CopyTo(Path.Combine(Utils.GetFileDirectory2(), newname));


            GridView2.DataBind();
    }
     
    Thanks In Advance
    Jeff
     
     
     

    Filed under: ,
  •  02-03-2009, 9:55 PM 48334 in reply to 48329

    Re: Duplicates Uploaded files

    Jeff,
     
    Do you using AJAX ?
     
    I think there should be something to prevent the uploader reset it status, or let uploader restore the old hidden data.
     
    Please try args.MoveTo , once the file have been removed, the uploader would not fired the event again.
     
    That should help you fix that issue, but we still need find the real reason.
     
    Regards,
    Terry
  •  02-04-2009, 9:40 AM 48360 in reply to 48334

    Re: Duplicates Uploaded files

    Terry,
     I'll try that and let you know.
     
    Jeff
  •  02-05-2009, 1:03 AM 48398 in reply to 48360

    Re: Duplicates Uploaded files

    Hello Terry,
     Yes that works but now i can't delete any of the files that I've uploaded. Any Ideas?
     
    Jeff
  •  02-05-2009, 1:25 AM 48399 in reply to 48398

    Re: Duplicates Uploaded files

    Nevermind. My EnabledViewstate on my gridview is set to false. Thanks again.
View as RSS news feed in XML