How to upload a file to the server using web_custom_request

How to upload a file to the server using web_custom_request

Use the "BodyFilePath=fileName" attribute

You can use the "BodyFilePath=fileName" attribute to upload a file.

Example:

web_custom_request("Mercury",
"URL=http://…",
"Method=PUT",
"Resource=1",
"RecContentType=text/plain",
"Referer=",
"BodyFilePath=fileName",
LAST);

By default, LoadRunner will look into the script directory for the file. For such
1. When you run the script in the Controller, it is recommended that you:
a. Highlight the group and click the "Details" button.
b. Click <More> in the pop-up window.
c. Go to the "File used by script."
d. Make sure that your file is there or click <Add> to add the file.

2. Alternatively, you can specify the full path to the script. You will need to make sure that all the machines have the file in the same location.

Example:
"BodyFilePath=c:\\full_path\\fileName".

Advertisements

2 thoughts on “How to upload a file to the server using web_custom_request

  1. Reeta

    For running the script in PTC or controller with some load generators:

    In the script, goto left panel where you have Action. Right click and select “Add files to script”. Add the files which you want to upload in the script. And then run the script in controller or PTC.

    Reeta

    Reply
  2. Richard

    Hi, Am recording the script in http/html protcol and in that some excel doc need to upload. So, what i can do for that? even how this can work HP ALM Performance Center? Please guide some clear picture..

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s