fileprompt

fileprompt Prompts the user for a file to be uploaded. It returns a cloudobject representing the new file. The cloudobject created will be of a special type called "storedCloudFile", with the following properties:

Property Description
urlThe address of the file's bytes. It serves them only to the session the object was handed to (a device that received the object, through a cloud set or a variable), so a copied address, or one with another id, opens nothing. It is not a link for outsiders: to give the file to someone else, attach it to a mail with send_mail.
original_filenameThe file's original file name (with extension)
last_modified_timeUnix time stamp of the last modified time for the file.
sizeSize of the file in bytes.
extensionThe file's extension (e.g. "pdf")
mime_typeThe MIME type string for the file (e.g. "application/pdf")


If the user selects "cancel" then fileprompt will return FALSE. If fileprompt encounters an error, then it will return FALSE, an alert will be shown describing the error and the global variable "upload_error" will be set to the string describing the error.

Runs on: either side: the compiler places the statement that calls it where the values it uses live.

Format:

file_object = fileprompt()

Parameters:

This function does not take any parameters.

Returned Value:

Type Description
cloudobject The storedCloudFile created (or FALSE if cancelled or upload failed)

Examples

 document = fileprompt()
 if (upload_error) {
    alert(upload_error)
 }