WebFileUploader
From Xojo Documentation
Supported Platforms Project Types: Web Platforms: macOS, Windows, Linux |
WebFileUploader enables you create a list of files to upload to the server. You can then upload the list of files by calling the Upload method.
Properties | |||||||||||||||||||||||||||||||
|
Methods | ||||||||||||||||
|
Notes
Files that are larger than 256K are written directly to the temporary folder on the disk. If the temporary folder is not writable or the file is 256K or smaller than the file is kept in memory.
When the UploadeComplete event handler is called, all files in memory are also written to the temporary folder (if it is writable).
Starting with 2018r1, you can drag and drop files onto the WebFileUploader control to add them to the list.
Sample Code
To allow files to be uploaded to your web apps, add a FileUploader control to a web page. By itself, the user uses the "+" and "-" buttons to add or remove files to the list of files to upload. You'll want to add a WebButton to the page for the user to click to start the upload. In the Action event handler for the button, start the upload:
After the files have been uploaded, they will be in memory and the UploadComplete 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