UploadFiles – PB Docs 120


UploadFiles

Use to open the Upload Files dialog box that enables an application user to upload files from the local computer to the Web server.

Syntax

Parameters

  • serverFolder
    The folder on the server to which you want to copy one or more files from the client computer. PowerBuilder creates this folder under the server virtual root in the applicationName_rootsessionsessionID directory, or for someone logged in as a permanent user, in the applicationName_rootusersuserName directory.

  • bgColor
    A long for the background color of the Upload Files dialog box.

  • fileNum
    An integer for the number of text boxes to show in the Upload Files dialog boxes. Application users can upload as many files as there are text boxes in a single upload operation.
  • showServerFolder
    A boolean specifying whether to show the server folder name in the Upload Files dialog box. Values are:

    • true � the server folder name.
    • false � do not show the server folder name.
  • description
    Text that you want to appear near the top of the Upload Files dialog box. You can use an empty string if you do not want to show additional text in this dialog box.
  • allowExts
    A string that lets you limit the files a user can upload to files with the extensions you list. If you set this argument to an empty string, files with any file extension can be uploaded. If you list multiple extensions, you must separate each extension with a semicolon. You must include the “.” (dot) in the extensions you list.
  • callbackFunctionName
    (Optional) The callback function that lets you know whether the file is correctly uploaded to the Web server.
  • po
    (Optional) The name of a PowerBuilder object that has the callback function set in the callbackFunctionName argument.

Returns

None.

Examples


  • This example uploads the file to the application�s virtual root d:hhh directory on the server, sets the color of the Upload Files dialog box to the background color of the w_main application window, limits the number of files to be uploaded in a single operation to 3, does not show the server directory name in the Upload Files dialog box, but does show the “my description” text, and limits the types of files that can be uploaded to JPG and TXT files:


  • This example uses green as the background color for the Upload Files dialog box, limits the number of files to be uploaded in a single operation to 1, shows the server folder name in the Upload Files dialog box, and does not restrict the types of files a user can upload to the Web server:

Usage

Use the UploadFiles function in conjunction with a private callback function that you create for a PowerBuilder object.

The callback function should return an integer and take a string array for its only argument. The callback function script should include an iteration to fill up the string array with the names of files selected by the application user to upload to the server. For example, the following code can be added to a callback function “myuploadfiles_callback” with an upfiles[ ] string array argument:

If the “myuploadfiles_callback” function is created on the window w_main, you can use this window name as the value of the po argument in your Upload Files call. If you create the “myuploadfiles_callback” function as a global function, you can use the UploadFiles callback syntax without the po argument.

If your application uses sequential UploadFiles calls in the same script, only the callback function in the last of the UploadFiles calls is valid. The other UploadFiles calls can still upload selected files to the Web server, but further processing of the names of the uploaded files does not occur, even when the syntax for these calls includes a callback function that codes for such processing.

If the last UploadFiles call in a script containing sequential UploadFiles calls does not use a callback function, no callback processing occurs.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x