WebFileUploader
From Xojo Documentation
WebFileUploader allows the user to choose files to be uploaded. You can then upload the files by calling the StartUpload method.
Events | ||||||||||||
|
Methods | ||||||||
|
Notes
There will be a delay between the time files finish uploading and the UploadFinished event is called because the files must be processed once they are uploaded.
WebFileUploader will always try to write files to the temporary folder on the server if possible to save memory. If that is not possible (because the temporary folder doesn't exist or is not writable), the files are copied into a MemoryBlock.
Sample Code
To allow files to be uploaded by your web apps, add a FileUploader control to a web page. By itself, the user uses the Select button choose a file to be uploaded. Each time the user chooses a file, that file is added to the upload queue. If you wish to show the user a list of files they have chosen, add a WebListBox to the layout and then add files to that control when the FileAdded event handler is called. You'll likely also want to add a WebButton to the page for the user to click to start the upload. In it's Pressed event handler, call StartUpload:
After the files have been uploaded, they will be in memory and the UploadFinished event handler is called. Here you can process the uploaded files and choose to do something with them. This code saves uploaded files to disk (you'll need to make sure your web app has the correct permissions on the server in order to write files):
Var output As BinaryStream
For Each file As WebUploadedFile In files
Try
outputFile = New FolderItem(file.Name)
output = BinaryStream.Create(outputFile, True)
output.Write(file.Data)
output.Close
Catch e As IOException
Continue
End Try
Next