Re: MoveTo throws an exception

  •  05-28-2013, 6:53 AM

    Re: MoveTo throws an exception

    Hi Ken,

     

    I tried a different folder and got the same exception. Here is the ASPX code:

     

    <CuteWebUI:UploadAttachments runat="server" ID="MultiFileUploader"
                    InsertText="Add a File"
                    onfileuploaded="MultiFileUploader_FileUploaded">

    <asp:Button ID="AskButton" runat="server" Text="Ask Question"
                    onclick="AskButton_Click" /> 

     

    The part of the code-behind related to the uploader:

     

    private List<Guid> FileGuids {
                get {
                    if (ViewState["Guids"] == null)
                        ViewState["Guids"] = new List<Guid>();
                    return ViewState["Guids"] as List<Guid>;
                }
            }

     

    protected void MultiFileUploader_FileUploaded(object sender, CuteWebUI.UploaderEventArgs args) {
                FileGuids.Add(args.FileGuid);
            }

     

     protected void AskButton_Click(object sender, EventArgs e) {
                

                // Save Files
                foreach (Guid g in FileGuids) {
                    MvcUploadFile f = MultiFileUploader.GetUploadedFile(g);
                    f.MoveTo(ControlPath);
                }

               
            }

     

    I save the file GUIDs because I need to save the files when the Ask Button is clicked, not after each file is uploaded. However, I also tested moving the MoveTo method  to the FileUploaded event but got the same exception again.

View Complete Thread