I recently upgraded from Xojo 2017r3 to Xojo version 2018r1.1. I’m having some issues with the WebUploader control. It’s probably something I’m doing wrong but I can’t figure out what. I have a WebDialog in which I have added a WebUploader control. Whenever I need to upload a file in my WebApp, I create a new instance of the dialog and when I’m done processing the file in the UploadComplete handler, I close the dialog.
In the previous version of Xojo, this worked fine. But since I upgraded to 2018r1.1, it looks like the WebUploader keeps all the files in memory from one instance of the dialog to the next. I can’t figure out how to flush the file list after I have done processing them in the UploadComplete event handler. Could anyone please enlighten me. I would greatly appreciate it.
I actually found a way to clear the list from this post by Tim Parnell.
but it does not solve my problem!!! The second time I display the dialog, the WebUploader file list is empty but it still remembers the first file I chose to upload somehow. I know this because even though I do not add anything to the WebUploader list the second time around, when I call the Upload function, it still loads that first file from the first time I displayed the dialog!!!
How can I completely reset the WebUploader everytime I show the dialog???
I have this code in the Action event handler of a button:
Dim dlg As New dlgOpenFileDialog
dlg.Display(txtPasteArea)
The OpenFileDialog has a WebFileUploader control that lets the user choose their files. The UploadComplete event handler saves the file’s contents to the provided TextArea control. This is the code I have in the UploadComplete handler:
oTextArea.Text = ""
For Each file As WebUploadedFile In files
Try
Dim sData As String = DefineEncoding(file.Data, Encodings.WindowsANSI) //Encodings.UTF8
oTextArea.AppendText(ReplaceLineEndings(sData, App.sEOL))
Catch e As IOException
MsgBox("Could not load file.")
MyLog.LogStartup(CurrentMethodName, "IO Error while uploading file: " + file.Name + App.sEOL + e.Message)
Continue
End Try
Next
Me.Close
Self.Close
I also tried adding a Dismissed handler by changing the button Action event handler to the following:
Dim dlg As New dlgOpenFileDialog
AddHandler dlg.Dismissed, AddressOf HandleOpenFileDismissed
dlg.Display(txtPasteArea)
and the HandleOpenFileDismissed handler just closes the dialog but it still does not clear the WebFileUploader files!
I’ve reverted to Xojo 2017r3 and using the exact same code, the above problem does not occur… so it really seems to be something new happening in version 2018r1.1. I hope you can help me get it working again.
What would be most helpful to us would be if you could make a sample project which contains just this dialog and a button to open it. See if it exhibits the same behavior and then file a bug report using Feedback. That way Ill have something that we know shows the problem.