Forum Discussion

DLapus's avatar
DLapus
Occasional Contributor
11 years ago

Issue With File Upload

SmartBear Support,

I posted this while ago, was expecting some Pro support, still dint get any response, so I am reposting this as separate thread,
please check this.

I have to do a POST request for file upload. here is details of my call.
1. Attached the file in the tab, set it as multipart/form-data
2. Need to give some parameter values , which has information where the file will be upload.
I have put in tab below "media Type" - checked "Post Querystring"
sample data:
data
{ "FileBlade": "EBF9EE5649DB449E86F500C869BC2698",
"FileFolder": "C4FFF652663942828E50E7B2E4499915",
"ContentLength": 50000,
"ContentType": "txt"
}


when i POST the request i am getting 500 error. when i tried using "REST Console "chrome addon, this is working fine.
This is my test request:


---- start
POST http://ip/shared/customfiles HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/form-data; boundary="----=_Part_2_28697245.1370978871834"
Authorization: Bearer {b5814f3f-4562-4082-9a36-52a1705b5c4e}
MIME-Version: 1.0
Content-Length: 558
Host: ip
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)


-----=_Part_2_28697245.1370978871834
Content-Type: multipart/form-data
Content-Transfer-Encoding: 8bit

data

{ "FileBlade": "EBF9EE5649DB449E86F500C869BC2698",
"FileFolder": "C4FFF652663942828E50E7B2E4499915",
"ContentLength": 50000,
"ContentType": "txt"
}

------=_Part_2_28697245.1370978871834
Content-Type: multiform/form-data; name=Prtest.txt
Content-Transfer-Encoding: binary
Content-Disposition: form-data; name="Prtest.txt"; filename="Prtest.txt"

hi world
------=_Part_2_28697245.1370978871834--


SmartBear Support, can you please check and let me know what is wrong here.
Thanks for the help.

3 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    I have answered your other thread as well.

    Anyway, based on this one, you don't need to check "Post QueryString".

    Can you see any differences between what SoapUI posts and the successful request?

    Regards,

    Renato
    SmartBear Software
  • DLapus's avatar
    DLapus
    Occasional Contributor
    Thanks , Still i am getting the error.

    Please find the sample request which passes - Using REST Console:

    Request Method: POST
    Http Version: 1.1
    Request Uri: http://10.52.1.162/shared/customfiles
    Request Headers:
    Connection: keep-alive
    Accept: application/json
    Accept-Encoding: gzip,deflate,sdch
    Accept-Language: en-US,en; q=0.8
    Authorization: Bearer 31aeb74c-821d-41b1-a21e-aa8f8ed8ddff
    Host: 10.52.1.162
    User-Agent: Mozilla/5.0,(Windows NT 6.1; WOW64),AppleWebKit/537.36,(KHTML, like Gecko),Chrome/28.0.1500.71,Safari/537.36
    Origin: chrome-extension://cokgbflfommojglbmbpenpphppikmonn
    Content-Length: 1098
    Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryEgZf6pZEAfDlGSkJ
    Request Content: ------WebKitFormBoundaryEgZf6pZEAfDlGSkJ
    Content-Disposition: form-data; name="data"

    { "FileBlade": "EBF9EE5649DB449E86F500C869BC2698", "FileFolder": "C4FFF652663942828E50E7B2E4499915", "ContentLength": 50000, "ContentType": "txt" }
    ------WebKitFormBoundaryEgZf6pZEAfDlGSkJ
    Content-Disposition: form-data; name="Password_Change.txt"; filename="Password_Change.txt"
    Content-Type: text/plain

    file content
    ------WebKitFormBoundaryEgZf6pZEAfDlGSkJ--
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    It's been a while so I am not sure what the problem seems to be.... if you look carefully at the request generated by SoapUI and the one generated by your other tool, can you see anything different?

    A HTTP 500 Response from the server implies that the server could not process the request. Can you check the server log to see why the Server had trouble with the request?

    Regards,

    Renato
    SmartBear Software