Results 1 to 2 of 2

Thread: FileUpload Form-Post - How to send errors to the client

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Feb 2011
    Vote Rating

    Default FileUpload Form-Post - How to send errors to the client

    Hi Sencha Team,

    as stated by the Ext-Direct Documentation ( a Form-Post response should also always contain the following information:
    • type rpc
    • tid The transaction id that has just been processed
    • action The class/action that has just been processed
    • method The method that has just been processed
    • result The result of the method call
    But what can we do in case that the Server receives a large file-upload ?
    The server will receive the POST-Request from the Client as a multipart form message in the following order:

    artID 100005 (user-parameter)
    artmediaid -1 (user-parameter)
    upload 3ffsdofwfdskfdk..... (file-upload)
    extTID 38 (generated by ext)
    extAction ArtImage (generated by ext)
    extMethod upload (generated by ext)
    extType rpc (generated by ext)
    extUpload true (generated by ext)

    the server should stop parsing the file upload if it is too large. But therefore the server can not read out the extAction-, extMethod-Parts because they come after the upload-Part. Therefore the server can not send a valid response to the client that contains 'action', 'method' and 'tid'....

    Is there any known way the server can send an error code to the client for too large file uploads?

    If the server does not send any response to the client, the client will wait forever an can not inform the user about the problem.

    thanks for any info to this,

    b. huber

  2. #2
    Sencha User
    Join Date
    Feb 2011
    Vote Rating


    we have now implemented a workaround for this ...

    if our java server receives a file upload that is larger than allowed we send back the following response to the extjs-client:

      <head><meta content="text/html; charset=UTF-8"/></head>
      <textarea>    {"errorcode":413,"errormessage":"5242880 bytes","type":"rpc"}
    The ExtJS-Client then can read out this response like so.

    Ext.util.Observable.observe(;'data', function(provider, event){
      if (event.errorcode) {
        if (event.errorcode === 413) {
          // request entity too large
            title   : osm.base.res.UploadSizeError.title,
            msg     : Ext.String.format(app.base.res.UploadSizeError.msg, event.errormessage), 
            buttons : Ext.Msg.OK,
            icon    : Ext.MessageBox.ERROR,
            scope   : this
    The showing of the Message-Box will also hide all open Loading-Masks.

    Is this a valid workaround ?

    The only problem i see is that the open ext-transaction will remain in the forever,
    because the server can not return the TID in the case of a large file upload. If the TID is not returned ExtJS can not remove the corresponding ext-transaction.

    any info on this would be great. Until we will use this workaround.

    B. Huber

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts