0

I want to upload a file using java client to server where content type should be application/x-www-form-urlencoded .

Using java.net.URLConnection to fire and handle HTTP requests has nice explanation on how to use application/x-www-form-urlencoded but I coudn't find a way to upload file using this .

Are there any hints to do this? (Don't suggest to use multipart/form-data)

Community
  • 1
  • 1
Jenananthan
  • 1,191
  • 2
  • 9
  • 17
  • Percentile-encoded upload? Really? Why not put the entire entire file in the HTTP body, and set the content type to mime of the file? If server expects urlencoded data: 1) Its plain stupid. 2) upload file size can probably increase to around 3 times. – UltraInstinct Jan 04 '15 at 07:53
  • I have to submit data of a form using java. where there are multiple elements to be submitted to server. one of them is a File (File size is not a problem here for me) – Jenananthan Jan 04 '15 at 08:34
  • 1
    Use multipart form data in that case. I don't understand why you wouldn't want a standard approach. URLEncoding file data is bad, very bad. – UltraInstinct Jan 04 '15 at 10:24

0 Answers0