We have two file upload api's. One for uploading resume and other for uploading profile picture. Upload resume api takes one file as parameter. I tried below code.
------WebKitFormBoundaryPTjnjok43Hg6SN0w
Content-Disposition: form-data; name="file"; filename="sample.pdf"
Content-Type: application/pdf
Content-Transfer-Encoding: binary
${__FileToString(${P_ResumeFileLocation},,)}
------WebKitFormBoundaryPTjnjok43Hg6SN0w--
API is passing. However if I download the uploaded file, it is not showing any data. Later i tried multipart/form-data option and gave file location in file upload tab. API is getting passed and I can see data correctly after downloading same.
I went ahead and tried the same for upload picture api too. This api needs file, width and height parameters to be passed. I created two parameters in parameters tab and placed the file details in file-upload tab. API failed saying invalid method. Actually API takes file as first parameter and width, height later. In jmeter request tab I can see file is passed at last.
And i tried below code also:
------WebKitFormBoundaryRo2HSZXcGbDUiLyU
Content-Disposition: form-data; name="file"; filename="samplepicture.jpg"
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
${__FileToString(${P_ProfileImageLocation},,)}
------WebKitFormBoundaryRo2HSZXcGbDUiLyU
Content-Disposition: form-data; name="width"
1000
------WebKitFormBoundaryRo2HSZXcGbDUiLyU
Content-Disposition: form-data; name="height"
1000
------WebKitFormBoundaryRo2HSZXcGbDUiLyU--
API is passing but i don't see a proper image when I download it.
I recorded the flow using fiddler. And I can re-issue the api request in fiddler successfully and can view image properly after downloading. I tried copying raw data from fiddler request, but no luck
I need to performance test those two api's using jmeter. Kindly let me know where I'm making mistake.