WebFileUploader.UploadComplete

From Xojo Documentation

Event


WebFileUploader.UploadComplete(Files() as WebUploadedFile)

New in 2010r5

Supported for all project types and targets.

UploadComplete is called when the the browser has finished uploading the files to the server.

Notes

If the temporary folder is writable, all files are written to disk when this event handler is called. If the temporary folder is not writable, all files are kept in memory.

Files that are in the temporary folder are deleted when this event handler returns. Be sure to store the files elsewhere by using either the Save method or using the Data property to get the data.

For a file on disk, accessing the Data property loads the file into memory.

Example

This example will process all the files that were uploaded and save only the pictures to the UploadFolder on the server.

Var source As Picture
Var pictureFile As FolderItem

Var uploadFolder As FolderItem
uploadFolder = New FolderItem("UploadFolder")

If Not uploadFolder.Exists Then
uploadFolder.CreateAsFolder
End If

For Each file As WebUploadedFile In Files
Try
source = Picture.FromData(file.Data)

// Create a file on the server
pictureFile = uploadFolder.Child(file.Name)

source.Save(pictureFile, Picture.SaveAsPNG)

Catch e As UnsupportedFormatException
Continue // Skip this file
End Try
Next