WebUploadedFile

From Xojo Documentation
Jump to: navigation, search

Class (inherits from Object)

A file that was processed by WebFileUploader. The array of uploaded files is made available in WebFileUploader.UploadComplete.

Properties
Data ReadOnlyProperty.png MIMEType ReadOnlyProperty.png Size ReadOnlyProperty.png
File ReadOnlyProperty.png Name ReadOnlyProperty.png


Methods
Save

Notes

If the temporary folder is writable, the File property will point to the temporary file and the Save method will allow you to save the file elsewhere. You can also use the Data property to load the file into memory.

Any temporary files that are created by the upload process are deleted when the WebFileUploader.UploadComplete event handler returns.

If the temporary folder is not writable, the files are kept in memory and accessed using the Data property.

Example

This code in WebFileUploader.UploadComplete will process all the files that were uploaded and save only the pictures to the UploadFolder on the server.

Dim source As Picture
Dim pictureFile As FolderItem

Dim uploadFolder As FolderItem
uploadFolder = GetFolderItem("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

See Also

WebFileUploader, FolderItem

Personal tools
Namespaces

Variants
Actions
Main
Content
Starting Out
Dig Deeper
More Help
Toolbox
About