Nobody
Nobody

Reputation: 539

How to upload and encode (base64) a file in webservice using Jmeter

I am new to Jmeter and I need to upload a file and then encrypt the file using base64.

I am able to encode the filename and file path to base64, however I need to both upload and then encrypt the file (base64).

I attempted to use the jmeter custom extension to encode the file, however it encoded the file.

Any ideas on how I can upload the file (text/plain or text/csv or application/excel) and then encode (base64) the file.

Is it possible to specify filetostring function in jmeter ans then encode the string?

Upvotes: 1

Views: 3111

Answers (2)

Nobody
Nobody

Reputation: 539

Yes, I managed to resolve the issue. I used the same custom jmeter functions and the __fileToString() function.

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 168042

You can do this using __FileToString() and __base64Encode() functions combination like:

${__base64Encode(${__FileToString(/path/to/your_file)})}

You can install __base64Encode() function as a part of Custom JMeter Functions bundle using JMeter Plugins Manager

JMeter Functions Plugins Manager

Upvotes: 4

Related Questions