Facing issue in file upload in "Use multipart/formdata for POST' scenario

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Facing issue in file upload in "Use multipart/formdata for POST' scenario

neeraj.kumar37@wipro.com.INVALID
Hi Team,

I am facing issue in file upload in "Use multipart/formdata for POST' scenario in Jmeter.

I have some parameters and a file to upload through application request. My request is passed in below format:
POST data:
--U-vs1MTIQWNtOTukw4J366lA0xKWNxa
Content-Disposition: form-data; name="Employeto.employeeSurname"
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit
....
....
....
....


I have tried both steps :

1.Ticked Use multipart/form-data for POST box in the HTTP Request sampler.
2.Removed tag of Content-Type header in the HTTP Header Manager.

Still I am getting error in Response :{"Error Occurred While Saving File.","result":null}
. . .
What could be the resolution. Could anyone help.


Regards,
Neeraj Kumar
+91-9158915417



Sensitivity: Internal & Restricted

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com
Reply | Threaded
Open this post in threaded view
|

Re: Facing issue in file upload in "Use multipart/formdata for POST' scenario

ljmwaugh
Hi Neerja,

I had to do something similar and got around the issue like this.

Create a HTTP Header Manager
Specify
Content-Type multipart/form-data; boundary=zyxw11111111111111abcd

In the HTTP Request Sampler in the Body Data specify

--zyxw11111111111111abcd
Content-Disposition: form-data; name="metadata"

{"description":"test math document","title":"Test Doc ${cn_filename}","standards":{},"source":{"provider":"IBM","publisher":"IBM"},"authors":["carmine"],"academic":{"grades":["5","6","7"]}}
--zyxw11111111111111abcd
Content-Disposition: form-data; name="file"; filename="${cn_filename}"
Content-Type:text/html

"${__FileToString(/Users/[hidden email]<mailto:Users/[hidden email]>/github/cn-jmeter-tests/API_Load_Tests/${cn_filename})}"
--zyxw11111111111111abcd--


You will need to change the parameters of course.  I don’t think you will need the first section but you may.  I’m not sure what the specifications are for your API.

Regards,

Lisa JM Waugh
Performance Test Engineer
Pricing@IBM
Phone: 1-720-342-5373 | Mobile: 1-704-907-7008
E-mail: [hidden email]<mailto:[hidden email]>

3039 E Cornwallis Rd
Research Triangle Park, NC 27709-2195
United States

On Jun 6, 2020, at 7:58 AM, [hidden email]<mailto:[hidden email]> <[hidden email]<mailto:[hidden email]>> wrote:

Hi Team,

I am facing issue in file upload in "Use multipart/formdata for POST' scenario in Jmeter.

I have some parameters and a file to upload through application request. My request is passed in below format:
POST data:
--U-vs1MTIQWNtOTukw4J366lA0xKWNxa
Content-Disposition: form-data; name="Employeto.employeeSurname"
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit
....
....
....
....


I have tried both steps :

1.Ticked Use multipart/form-data for POST box in the HTTP Request sampler.
2.Removed tag of Content-Type header in the HTTP Header Manager.

Still I am getting error in Response :{"Error Occurred While Saving File.","result":null}
. . .
What could be the resolution. Could anyone help.


Regards,
Neeraj Kumar
+91-9158915417



Sensitivity: Internal & Restricted

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com<http://www.wipro.com>

Reply | Threaded
Open this post in threaded view
|

RE: Facing issue in file upload in "Use multipart/formdata for POST' scenario

neeraj.kumar37@wipro.com.INVALID
Thanks Lisa for your suggestion.

But I have another challenge.

All the values are passed though Parameters tab in HTTP sampler in form of Name and Value pairs.
The Body tab in HTTP sampler is disabled. Files upload tab is also empty. I have tried passing the file from there but same error observed.
The request format which I shared in my mail is shown in Request Body in the View Results Tree listener  of Jmeter.

I think Jmeter is taking the parameters from Parameter tab of the HTTP sampler and passing them in that request format to server.

Header manager of that request is passing values as below for content type :
Content-Typemultipart/form-data; boundary=----WebKitFormBoundaryT5FgmgC6hY6RvwEh

What else can be done in this situation.

Regards,
Neeraj Kumar


Sensitivity: Internal & Restricted

-----Original Message-----
From: Lisa Waugh - [hidden email] <[hidden email]>
Sent: Monday, June 8, 2020 7:49 PM
To: JMeter Users List <[hidden email]>
Subject: Re: Facing issue in file upload in "Use multipart/formdata for POST' scenario

** This mail has been sent from an external source **

Hi Neerja,

I had to do something similar and got around the issue like this.

Create a HTTP Header Manager
Specify
Content-Type multipart/form-data; boundary=zyxw11111111111111abcd

In the HTTP Request Sampler in the Body Data specify

--zyxw11111111111111abcd
Content-Disposition: form-data; name="metadata"

{"description":"test math document","title":"Test Doc ${cn_filename}","standards":{},"source":{"provider":"IBM","publisher":"IBM"},"authors":["carmine"],"academic":{"grades":["5","6","7"]}}
--zyxw11111111111111abcd
Content-Disposition: form-data; name="file"; filename="${cn_filename}"
Content-Type:text/html

"${__FileToString(/Users/[hidden email]<mailto:Users/[hidden email]>/github/cn-jmeter-tests/API_Load_Tests/${cn_filename})}"
--zyxw11111111111111abcd--


You will need to change the parameters of course.  I don’t think you will need the first section but you may.  I’m not sure what the specifications are for your API.

Regards,

Lisa JM Waugh
Performance Test Engineer
Pricing@IBM
Phone: 1-720-342-5373 | Mobile: 1-704-907-7008
E-mail: [hidden email]<mailto:[hidden email]>

3039 E Cornwallis Rd
Research Triangle Park, NC 27709-2195
United States

On Jun 6, 2020, at 7:58 AM, [hidden email]<mailto:[hidden email]> <[hidden email]<mailto:[hidden email]>> wrote:

Hi Team,

I am facing issue in file upload in "Use multipart/formdata for POST' scenario in Jmeter.

I have some parameters and a file to upload through application request. My request is passed in below format:
POST data:
--U-vs1MTIQWNtOTukw4J366lA0xKWNxa
Content-Disposition: form-data; name="Employeto.employeeSurname"
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 8bit
....
....
....
....


I have tried both steps :

1.Ticked Use multipart/form-data for POST box in the HTTP Request sampler.
2.Removed tag of Content-Type header in the HTTP Header Manager.

Still I am getting error in Response :{"Error Occurred While Saving File.","result":null} . . .
What could be the resolution. Could anyone help.


Regards,
Neeraj Kumar
+91-9158915417



Sensitivity: Internal & Restricted

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. https://apc01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.wipro.com%2F&amp;data=02%7C01%7Cneeraj.kumar37%40wipro.com%7C67c3d33954cb45a8157408d80bb6f326%7C258ac4e4146a411e9dc879a9e12fd6da%7C0%7C0%7C637272227688270221&amp;sdata=aNeeV3QsyXCpkPhbe%2FXiPyDcOTJHvZbRRXpb6wFIsoU%3D&amp;reserved=0<https://apc01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.wipro.com%2F&amp;data=02%7C01%7Cneeraj.kumar37%40wipro.com%7C67c3d33954cb45a8157408d80bb6f326%7C258ac4e4146a411e9dc879a9e12fd6da%7C0%7C0%7C637272227688270221&amp;sdata=aNeeV3QsyXCpkPhbe%2FXiPyDcOTJHvZbRRXpb6wFIsoU%3D&amp;reserved=0>
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]