Highlighted
Regular Contributor.
Regular Contributor.
690 views

Web HTTP Protocol FileUpload Issue

Jump to solution

Hi Team,

I am doing some scripting using web protocol in VuGen 12.55. The scenario is file upload scenario. 

I have attached the physical file in VuGen extra file location. I am showing sample request below:

web_submit_data("scan-and-save-receipt",
"Action=https://xyz.com/app/en/save-receipt",
"Method=POST",
"EncType=multipart/form-data",
"TargetFrame=",
"RecContentType=application/json",
"Referer=https://xyz.com/app/en/",
"Snapshot=t42.inf",
"Mode=HTML",
ITEMDATA,
"Name=image", "Value=3MB.jpg", "File=Yes", ENDITEM,
LAST);

Now during reply I notice that application is throwing HTTP Status-Code=403 (Forbidden) error with LoadRunner/VuGen as its sending FileName along with relative path. If I am running from StormRunner load I am getting same request param but with the filename location from LG. Please find the VuGen request param below:

Content-Disposition: form-data; name="image"; filename="C:\_Projects\**************\Receipts\3MB.jpg"
Content-Type: image/pjpeg

But its working fine with JMeter as JMeter dont send relative path along with the filename. Please see JMeter request below:

Content-Disposition: form-data; name="image"; filename="3MB.jpg"
Content-Type: image/jpeg
Content-Transfer-Encoding: binary

Is there any way to remove the filepath name in VuGen and send only the FileName instead of full path?

Labels (2)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Web HTTP Protocol FileUpload Issue

Jump to solution

Read the help on web_submit_data(), and experiment with ItemData entry FilePath.

Signature:
Reward community members who take time to respond and help.

View solution in original post

0 Likes
5 Replies
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Web HTTP Protocol FileUpload Issue

Jump to solution

Read the help on web_submit_data(), and experiment with ItemData entry FilePath.

Signature:
Reward community members who take time to respond and help.

View solution in original post

0 Likes
Highlighted
Regular Contributor.
Regular Contributor.

Re: Web HTTP Protocol FileUpload Issue

Jump to solution
I have added files under Extra Files. But still I am getting HTTP Status-Code=403 (Forbidden).

Script ITEM DATA:

ITEMDATA,
“Name=claimApplicationPk”, “Value={c_claimApplicationPK}”, ENDITEM,
“Name=image”, “Value=3MB.jpg”,
“FilePath=C:\\_Projects*********\\3MB.jpg”,
“File=Yes”,
“ContentTransferEncoding=binary”,
“ContentType=image/jpeg”,
ENDITEM,

Now LoadRunner Sending Request as:
—————————-7d025e2b16b064e
Content-Disposition: form-data; name=”claimApplicationPk”

88**********23
—————————–7d025e2b16b064e
Content-Disposition: form-data; name=”image”; filename=”3MB.jpg”
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
=================================================================================================
JMeter Request Now:

POST data:
—————————–7d159c1302d0y0
Content-Disposition: form-data; name=”claimApplicationPk”

88**********47
—————————–7d159c1302d0y0
Content-Disposition: form-data; name=”image”; filename=”3MB.jpg”
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
============================================================================================
Not Sure what I am missing here
0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Web HTTP Protocol FileUpload Issue

Jump to solution

Looks like that part is then covered. You might check all the cookies, headers between LR and JMeter. You might use an tool to sniff the NW traffic to be able to compare at lowest level.

When you have access to that server or admins on that server, you might ask them to go through the logs at your time of testing.

Signature:
Reward community members who take time to respond and help.
Highlighted
Regular Contributor.
Regular Contributor.

Re: Web HTTP Protocol FileUpload Issue

Jump to solution

This is resolved now. 

I was sending CSRFToken twice in header. Removed one and it worked.

Thanks for guiding me for ITEM DATA part, that help.

0 Likes
Highlighted
Visitor.

Re: Web HTTP Protocol FileUpload Issue

Jump to solution

Hi Sujay,

Can you help me with your full vugen request, in my case i have to upload pdf file along with meta data in json file format.

Can you please help on this.

 

Thanks,

Saikiran.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.