getFileName() | Zoho QEngine Help

getFileName()

1. Overview 

The getFileName() function returns the name of the specified input file, including its extension. This is useful for validating file naming conventions or confirming that the expected file has been retrieved or downloaded.

2. Syntax

<variable> = files.<filename>.getfilename();

Parameter
Description
<variable>
Defines the response returned by the getFileName() function. It represents the name of the file as a string.
<fileObject>
Specifies the file object to be accessed. This can be a file downloaded, invoked via URL, or loaded from saved files.

3. Example 

  1. //perform file function action on a file saved locally
  2. FileName = files.ztest.getfilename();

 

  1. //perform file function action on a downloaded file
  2. assertFileDownload("downloadedfile.txt",5,errorhandling.STOP_ON_ERROR);
  3. DownloadFile = File("downloadedfile.txt");
  4. FileName = DownloadFile.getfilename();

 

  1. //to fetch file using invoke URL and perform file functions
  2. File =  invokeURL[
  3. url : "<downloadURL>"
  4. type:GET
  5. ];
  6. FileName = File.getfilename();