fsFilePut

Uploads a file to an FTP server.

Syntax:

fsFilePut( client-handle, local-file, remote-file [, create-directories] )

Parameters:

(s) client-handle: FTPS extender client handle.

(s) local-file: name of the local file (optionally with path) to upload.

(s) server-file: name for file on the server file (with path as needed).

(i) create-directory: (optional) @True to create any non-existent directories preceding the file name in local-file or server-file.

Returns:

(i)@True(1) on success

The fsFilePut function uploads a file to the FTPS server associated with the client-handle.

 

client-handle

FTPS extender client handle obtain by a call to the fsClientInit function.

 

local-file

Use this parameter to indicated the source file to upload. Include path information as need so that the function can find the correct file.

 

remote-file 

Use this parameter to specify the uploaded file's name on the FTP server. Include any necessary server path information to insure the file is placed in the correct location on the server. The function creates directories depending on any path information in the parameter and the value of the create-directory parameter. If you pass an empty string ("") in this parameter, the local-file parameter's path and file-name are used for the server file's path and file name.

 

Note: The function removes any drive letter specification from the local-file path when the remote-file is set to an empty string before using it as the server path and file name. It does not, however, remove a name-space prefix  from a UNC style path.

 

create-directory

Set this optional parameter to @True(1) and the function creates any non-existent directories in the  the file name contained in the remote-file parameter's path or in the local-file parameter's path when remote-file is an empty string. Setting the parameter to  @False(0) causes the function to error if any of the directories in the path contained in remote-file (or local-file when used instead) do not exist on the server. If the parameter is not specified, @False is assumed.

 

Note: The server user account associated with client-handle must have sufficient privileges when directory creation is required and create-directory is set to @True.

Example:
  AddExtender('ilcfs44i.dll',0,'ilcfs64i.dll')
  host = 'test.example.com'
  port = 21
  user = 'demo'
  pswd  = 'password'
  
  ; Create a client
  client = fsClientInit(host, port, user, pswd)
  
  ; Upload a file using the local system path and file name on 
  ; the server also
  fsFilePut(client, 'bmp\FalcoPeregrinus.png', '',  @true)
  
  ; Upload a file to an existing directory using a new file name
  fsFilePut(client, 'bmp\large.galaxies.jpg', 'bmp\GalaxyCluster.jpg')
  
  ; Disconnect and clean up
  fsClientDelete(client)
See Also:

fsClientInit, fsFileGet, fsFileGetWild, fsFileInfo