OnFileUpload - cWebDragDropFileHelper

Hook to initialize the upload providing the target path for uploaded files

Type: Event

Return Data Type: String

Parameters: String sFileName BigInt iBytes String sMime

ParameterDescription
sFileNameIs the filename (without path) of the file being uploaded
iBytesIs the size in bytes of the file being uploaded
sMimeMIME type of the file being uploaded


Return Value

This function must return the full path and filename where the uploaded file is to be saved.


Syntax
Function OnFileUpload String sFileName BigInt iBytes String sMime Returns String

Description

This event is fired before a new file upload starts. Its task is to determine the local path where the file should be stored. This needs to be an absolute path. The file path should include the file name.

Details of the uploaded file are sent as parameters. Note that the file size and Multipurpose Internet Mail Extensions (MIME) type can be empty on older browsers that do not provide this information.

OnFileUpload is called for each file in case of a multi file upload.

An empty string can be returned to cancel the file upload. In case of a multi file upload, the specific file will be cancelled but others will continue.

Sample

Function OnFileUpload String sFileName Integer iBytes String sMime Returns String
    String sPath

    // Determine local path based on workspace setting
    Get psDataPath of (phoWorkspace(ghoApplication)) to sPath
    Move (sPath + "\Uploads\" + sFileName) to sPath

    Function_Return sPath
End_Function


For security reasons, the upload folder needs to be registered as an accessible upload folder for every process using RegisterUploadFolder.


Drag and Drop Support

This event does nothing in the cWebDragDropFileHelper class.

See Also

pbMultiFile