Upload file
Command Description
HTTP.UploadFile post upload file
Command Prototype
sRet = HTTP.UploadFile(url, file_path, data, headers, cookies, cert, timeout)
Command parameter
parameter | mandatory | type | default value | Instructions |
---|---|---|---|---|
url | True | string | "" | Request URL |
file_path | True | string | "" | File path, only supports passing in a single file, supports passing in two types of values, one is a string and the other is a dictionary; When a string is passed in, that is, the file path, the file name requested is "file"; When used as a dictionary, the format is {"path": "C: \ A. txt", "name": "XX"}, representing the file path and the file name specified at the time of the request |
data | False | expression | {} | Request body data, upload file with additional data, which can be a string or dictionary |
headers | False | expression | {} | Request Header |
cookies | False | expression | {} | Request cookie |
cert | False | expression | {} | If the certificate, dictionary type, certificate path, and key are all empty, the authentication will be ignored. If there is no key, the key can be left blank |
timeout | False | number | 0 | Timeout (milliseconds) |
Return result
SRet, Assign the result of running the command to this variable.
Run instance
/**************************Upload file**************************
Command prototype:
sRet = HTTP.UploadFile(url, file_path, data, headers, cookies, cert, timeout)
Input parameters:
url -- Link address. Note: Link address of the Post page.
file_path -- File path. Note: File path.
data -- Request body data. Note: Request body data.
headers -- Request headers. Note: Request headers.
cookies -- Request cookies. Note: Request cookies.
cert -- Client certificate. Note: Client certificate.
timeout -- Timeout (in milliseconds). Note: Timeout (in milliseconds).
Output parameters:
sRet -- The variable where the output of the function call is saved.
Notes:
None
******************************************************************/
Dim sRet = ""
sRet = HTTP.UploadFile("http://upload.example.com", "c:\test.txt", {}, {}, {}, "", 60000)
TracePrint(sRet)