I have a DynamicForm with only an UploadItem in order to upload an image file to the server.
I have the corresponding datasource.ds.xml file
I choose a file with the UploadItem and perform
On the server side, my REST WS handle the request and retrieve the file, I create file in some directory and answer back the file encoded in Base64
As the result my client is freeze waiting in the read() method of SocketInputStream, i don't know why. Can somebody help me ?
Code:
mainForm = new DynamicForm();
mainForm.setNumCols(2);
mainForm.setHeight100();
UploadItem fileItem = new UploadItem("imageData", "Image Data");
fileItem.setShowTitle(false);
DataSource dsImageBinary = DataSources.IMAGEBINARY.rest();
mainForm.setDataSource(dsImageBinary);
mainForm.setItems(fileItem);
addMember(mainForm);
Code:
<DataSource ID="imagebinary" dataURL="../catv_webservices/imagebinary?app=catv_client">
<fields>
<field primaryKey="true" name="id" hidden="true" type="sequence" />
<field name="imageData" type="imageFile" />
</fields>
</DataSource>
Code:
mainForm.saveData();
Code:
"response" : {
"status" : 0,
"data" : [ {
"id" : 1,
"imageData" : "data:image/png;base64,iVBOR..."
} ]
}
}