file upload problem

551 views
Skip to first unread message

Gurami Jugheli

unread,
Oct 23, 2012, 8:48:28 AM10/23/12
to extdire...@googlegroups.com
trying to upload xls file, i'm using extjs 4 and last version of extdirectspring, i'm doing all this according  https://github.com/ralscha/extdirectspring/wiki/Form-Post-With-Upload, i think i did everything properly but there is an exception:
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('-' (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value
 at [Source: org.apache.catalina.connector.CoyoteInputStream@2dd4b276; line: 1, column: 3].
router is trying to deserializing json to object, but it should not. can anyone help me? :(

Ralph Schaer

unread,
Oct 23, 2012, 10:01:04 AM10/23/12
to extdire...@googlegroups.com
Do you have an example project that demonstrates the problem? Or can you post the javascript code of the form and the java code of the post method. 

kever h

unread,
Jan 17, 2014, 5:45:40 AM1/17/14
to extdire...@googlegroups.com
I occurred this problem too, there are few upload examples in the https://github.com/ralscha/extdirectspring/wiki/Form-Post-With-Upload, where can I download the examples(backend site)?

Ext.define('MasterData.StoredFileForm',{
  "extend" : "Form.BasicForm",
  "paramsAsHash" : true,
  "fileUpload": true,
  "items" : [ {
    "hidden" : true,
    "xtype" : "textfield",
    "name" : "id",
    "fieldLabel" : "Id"
  }, {
    "xtype" : "combo",
    "name" : "fileType",
    "fieldLabel" : "File Type",
    "store" : {
      "type" : "array",
      "fields" : [ "fileType" ],
      "data" : [ [ "image" ], [ "file" ] ]
    },
    "displayField" : "fileType",
    "valueField" : "fileType"
  }, {
    "xtype" : "filefield",
    "name" : "file",
    "fieldLabel" : "File",
    "allowBlank" : false
  } ],
  "layout" : null,
  "width" : 300,
  "height" : 130,
  "defaults" : {
    "bodyStyle" : "padding:20px",
    "labelAlign" : "right"
  },
  "api" : {
    "load" : "commonService.getRecord",
    "submit" : storedFileService.saveRecord
  },
  "initFromServer" : false,
  "loadFromList" : false,
});

//---------------------------------------------------- server side
@Service
public class StoredFileService extends CommonService {
@ExtDirectMethod(ExtDirectMethodType.FORM_POST)
public ExtDirectFormPostResult saveRecord(
@RequestParam("file") MultipartFile file) throws IOException {

ExtDirectFormPostResult resp = new ExtDirectFormPostResult(true);

if (file != null && !file.isEmpty()) {
resp.addResultProperty("fileContents", new String(file.getBytes(),
StandardCharsets.UTF_8));
}
return resp;
}
}

it even did not call the service

Ralph Schaer

unread,
Jan 17, 2014, 8:05:24 AM1/17/14
to extdire...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages