Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Help: File upload failed with "No such type 'binary'" warning

    Hi,

    when I call getUploadedFile("uploadfile") in my DMI, it returns null and in the log (see blow), there is a warning with "No such type 'binary'".

    Log
    Code:
    === 2012-01-31 13:16:36,443 [or23] DEBUG RPCManager - Processing 1 requests.
    === 2012-01-31 13:16:36,443 [or23] DEBUG RPCManager - Request #1 (DSRequest) payload: {
        values:{
            uploadfile:"C:\\upload_template.csv"
        },
        operationConfig:{
            dataSource:"FILE_UPLOAD",
            operationType:"add"
        },
        componentId:"isc_DynamicForm_1",
        appID:"builtinApplication",
        operation:"FILE_UPLOAD_add",
        oldValues:{
        },
        criteria:{
        }
    }
    === 2012-01-31 13:16:36,443 [or23] INFO  IDACall - Performing 1 operation(s)
    === 2012-01-31 13:16:36,443 [or23] WARN  Validation - No such type 'binary', not processing field value at /FILE_UPLOAD/uploadfile
    === 2012-01-31 13:16:36,443 [or23] INFO  FileUploadDMI - appendErrorMessage: You must speciffy a valid file!
    === 2012-01-31 13:16:36,443 [or23] INFO  DSResponse - DSResponse: Map with 1 keys
    === 2012-01-31 13:16:36,443 [or23] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
    === 2012-01-31 13:16:36,443 [or23] DEBUG RPCManager - DMI response, dropExtraFields: true
    I use the power version: SC_SNAPSHOT-2011-03-28/PowerEdition Deployment 2011-03-28

    My Datasource looks as follows:

    Code:
    <DataSource 
    	ID="FILE_UPLOAD" 
    	serverType="generic">
    	
    	<fields>
    		<field name="uploadfile" title="File" type="binary" required="false" showFileInline="true"></field>
    		<field name="message" type="enum" required="false" hidden="true"></field>
    	</fields>
    
    	<serverObject lookupStyle="new" className="cpce.server.tmobviplist.FileUploadDMI" />
    	
    </DataSource>
    My DMI looks as follows:

    Code:
    public class FileUploadDMI {
    ...
    public DSResponse add(DSRequest record, HttpServletRequest req, HttpServletResponse resp) throws Exception { 
    
    		ISCFileItem file = record.getUploadedFile("uploadfile");
    		if(file == null){
    			
    			appendErrorMessage("You must speciffy a valid file!");
    			
    		}
    ...
    And my Client Code looks as follows:

    Code:
    uploadForm = new DynamicForm();
    uploadForm.setTop(5);
    uploadForm.setAutoHeight();
    uploadForm.setNumCols(3);
    uploadForm.setDataSource(DataSource.get("FILE_UPLOAD"));
    ...
    UploadItem fileItem = new UploadItem("uploadfile");
    fileItem.setWidth(500);
    uploadForm.setFields(fileItem );
    Last edited by Yared; 1 Feb 2012, 05:29.

    #2
    You can ignore the (spurious) warning, it's not the cause of the problem.

    Most likely, you have a FilterServlet that is interfering with request parsing before the SmartGWT server classes receive the servletRequest.

    First verify using Firebug that a file is actually uploaded from the browser. If you see an intact upload, remove any FilterServlets you've installed.

    Comment


      #3
      Thank you for the reply.

      I've now solved the problem. I used the field item "UploadItem" instead of "FileItem" for the upload DynamicForm. The last 3 client code lines look now as follows:

      Code:
      FileItem fileItem = new FileItem("uploadfile");
      fileItem.setWidth(500);
      uploadForm.setFields(fileItem);

      Comment

      Working...
      X