Jump to content
Tom Wellige

PBXUser.UploadFile

Recommended Posts

This function uploads a given file into the database, more precisely into the USER scope of the current script user.

Dim nResult, nRetVal
Dim sFilePath, nFileCategory, sFileName, sDescription, bOverWrite, bCompress

sFilePath     = "C:\Announcements\"
nFileCategory = PBXFileFileCategoryAnnouncements 
sFileName     = "MyAnnouncement.wav"
sDescription  = "my regular announcement"
bOverWrite    = True
bCompress     = False

nResult = PBXUser.UploadFile( _
		sFilePath, _
		nFileCategory, _
		sFileName, _
		sDescription, _
		bOverWrite, _
		bCompress, _
		nRetVal)

 

This function returns S_OK in case the file was uploaded successfully, or E_FAIL in case of a problem. The script should end immediately when getting anything else than S_OK.

 

The function takes the following parameters:

 

  • sFilePath (string value) - Local path to the folder, in which the file to be uploaded is located. The name of this file an be already included in this parameter. In this case the sFileName parameter has to be an empty string.
     
  • nFileCategory (integer value) - One of the following constants/values which define what kind of file this is:
    PBXFileFileCategoryRingTones = 0
    PBXFileFileCategoryCallRoutingScripts = 1
    PBXFileFileCategoryBitmaps = 2
    PBXFileFileCategoryAnnouncements = 3
    PBXFileFileCategoryHoldMusic = 4
    PBXFileFileCategorySkins = 8
    
  • sFileName (string value) - Name of the file to be uploaded. It must reside in the folder which is given in the sFilePath parameter. If the complete path and file name is already given in the sFilePath parameter, this parameter must be an empty string.
     
  • sDescription (string value) - Short description of this file. Will be displayed in the files list which can be opened on the "Files" tab within the server properties in the SwyxWare Administration.
     
  • bOverWrite (boolean value) - If True, an existing file with the same name in the USER scope will be overwritten. If False, an existing file with the same name in the USER scope will not be overwritten and the function will do nothing.
     
  • bCompress (boolean value) - If True, the uploaded file will be stored compressed in the SwyxWare database. If False, the uploaded file will be store uncompressed in the SwyxWare database.
     
  • nRetVal (integer value) - The function returns a PBXResult (a more detailed return value) into the variable which is given here.

 

 

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.