// Upload an Image
WebForm form = response.getFormWithName("stockImageUpload");
UploadFileSpec uploadFileSpec = createUploadFileSpec("audi.jpg", "http://localhost:8080/files/images/tradeweb/cars/audi.jpg");
form.setParameter("image", new UploadFileSpec[] {uploadFileSpec});
request = form.newUnvalidatedRequest();
request.setParameter("action", "save");
response = conversation.getResponse(request);
When the request is sent to the server the text parameters are prefix with an escape character so that the "save" I entered into the action parameter is received as "\rsave".
Has anyone else experienced this? If so is there a work around/solution?
Thanks in advance
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Attempting to use HttpUnit to submit a multipart form that includes both hidden text fields and a file input field.
<form name="stockImageUpload" method="POST" action="/tradeweb/uploadImages.do" enctype="multipart/form-data">
<input type="hidden" name="action" value="">
<input type="hidden" name="followingAction" value="">
<input type="file" name="image">
</form>
// Upload an Image
WebForm form = response.getFormWithName("stockImageUpload");
UploadFileSpec uploadFileSpec = createUploadFileSpec("audi.jpg", "http://localhost:8080/files/images/tradeweb/cars/audi.jpg");
form.setParameter("image", new UploadFileSpec[] {uploadFileSpec});
request = form.newUnvalidatedRequest();
request.setParameter("action", "save");
response = conversation.getResponse(request);
When the request is sent to the server the text parameters are prefix with an escape character so that the "save" I entered into the action parameter is received as "\rsave".
Has anyone else experienced this? If so is there a work around/solution?
Thanks in advance