Automatically Redirect after Upload is complete

Last post 06-29-2011, 9:05 PM by Kenneth. 3 replies.
Sort Posts: Previous Next
  •  06-29-2011, 2:21 PM 68260

    Automatically Redirect after Upload is complete

    Thanks for the quick reply on the File Upload naming question, it worked for me.  I have another question though.
     
    After the file is done uploading, the control seems to refresh the page automatically to itself.  Is there a way to prevent this?  I'm using the control in an iframe so I'd like the user to select the file, have the file be uploaded via the control, and then when done the control just displays that the file has been uploaded successfully.  The user would then have to fill out some other info and hit "Next". 
     
     EDIT: Also forgot to mention I am firing the following code to move the file correctly so I'd like this code to be executed to get the file to the right location and then "do nothing".
     
    1. <script runat="server">
          Public Sub Uploader_FileUploaded(sender as object, args as UploaderEventArgs)
          
              If System.IO.File.Exists("\\server1\upload\"+args.FileName) = True Then
                  System.IO.File.Delete("\\server1\upload\"+args.FileName)
              End If
          
              args.MoveTo("\\server1\upload\"+args.FileName)
          End Sub
      </script>
  •  06-29-2011, 3:12 PM 68263 in reply to 68260

    Re: Automatically Redirect after Upload is complete

    Hi djnotepad,
     
     
    You can find the following function in that example: 
     
    function CuteWebUI_AjaxUploader_OnPostback()   
    {  
            //clear the queue  
            this.reset();  
            //cancel postback while the ajax call have processed the files.  
            return false;   
     }  
     
    Thanks for asking
  •  06-29-2011, 4:14 PM 68264 in reply to 68263

    Re: Automatically Redirect after Upload is complete

    Unfortunately that isn't working for me.  When I call "return false" in the OnPostback() function my 
     
    1. Public Sub Uploader_FileUploaded(sender as object, args as UploaderEventArgs)  
    2.       
    3.         If System.IO.File.Exists("\\server1\upload\"+args.FileName) = True Then  
    4.             System.IO.File.Delete("\\server1\upload\"+args.FileName)  
    5.         End If  
    6.       
    7.         args.MoveTo("\\server1\upload\"+args.FileName)  
    8.     End Sub  
     
    function is NOT called, so the file is still in the "persisted.[guid].[filename].resx" format which is not what I want.  I need the function to be called to move the file to the correct location.
  •  06-29-2011, 9:05 PM 68268 in reply to 68264

    Re: Automatically Redirect after Upload is complete

    Hi djnotepad,
     
    If you need to the file upload to the server, the postback is necessary.
     
    If you want the user input some other info after upload and finally click a submit button to submit the form, please try the manually upload.
     
    Online demo
     
View as RSS news feed in XML