Uploading a file using FTP

In a previous recipe, we have seen how to download a file using XMLHttp. Here we will see how to upload a file to a web server using the FTP protocol.

Getting ready

From the File menu, navigate to New | Function Library or use the Alt + Shift + N shortcut. Name the new function library FTP.vbs. Make sure the library is associated to the test. In order to use the code given in this recipe, you must have an FTP user account on a server. To understand this recipe, you should be familiar with FTP protocol and the command line.

How to do it...

In the function library, we will put the following code.

  1. First we will define the following constants for better readability and reusability:
    const C_FSO="Scripting.FileSystemObject" const ...

Get Advanced UFT 12 for Test Engineers Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.