Uploading Files through GWT-RPC?










1















Uploading files with GWT is usually done with a FileUpload inside a FormPanel like this:



// Create a FormPanel and point it at a service.
final FormPanel form = new FormPanel();
form.setAction("/myFormHandler");

// Because we're going to add a FileUpload widget, we'll need to set the
// form to use the POST method, and multipart MIME encoding.
form.setEncoding(FormPanel.ENCODING_MULTIPART);
form.setMethod(FormPanel.METHOD_POST);

// Create a panel to hold all of the form widgets.
VerticalPanel panel = new VerticalPanel();
form.setWidget(panel);

// Create a TextBox, giving it a name so that it will be submitted.
final TextBox tb = new TextBox();
tb.setName("textBoxFormElement");
panel.add(tb);

// Create a ListBox, giving it a name and some values to be associated with
// its options.
ListBox lb = new ListBox();
lb.setName("listBoxFormElement");
lb.addItem("foo", "fooValue");
lb.addItem("bar", "barValue");
lb.addItem("baz", "bazValue");
panel.add(lb);

// Create a FileUpload widget.
FileUpload upload = new FileUpload();
upload.setName("uploadFormElement");
panel.add(upload);

// Add a 'submit' button.
panel.add(new Button("Submit", new ClickHandler()
public void onClick(ClickEvent event)
form.submit();

));


Are there any other ways to handle file upload with GWT? Is it possible to do in with GWT-RPC or REST?



Edit: Browser requirement is Only Webkit










share|improve this question




























    1















    Uploading files with GWT is usually done with a FileUpload inside a FormPanel like this:



    // Create a FormPanel and point it at a service.
    final FormPanel form = new FormPanel();
    form.setAction("/myFormHandler");

    // Because we're going to add a FileUpload widget, we'll need to set the
    // form to use the POST method, and multipart MIME encoding.
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);

    // Create a panel to hold all of the form widgets.
    VerticalPanel panel = new VerticalPanel();
    form.setWidget(panel);

    // Create a TextBox, giving it a name so that it will be submitted.
    final TextBox tb = new TextBox();
    tb.setName("textBoxFormElement");
    panel.add(tb);

    // Create a ListBox, giving it a name and some values to be associated with
    // its options.
    ListBox lb = new ListBox();
    lb.setName("listBoxFormElement");
    lb.addItem("foo", "fooValue");
    lb.addItem("bar", "barValue");
    lb.addItem("baz", "bazValue");
    panel.add(lb);

    // Create a FileUpload widget.
    FileUpload upload = new FileUpload();
    upload.setName("uploadFormElement");
    panel.add(upload);

    // Add a 'submit' button.
    panel.add(new Button("Submit", new ClickHandler()
    public void onClick(ClickEvent event)
    form.submit();

    ));


    Are there any other ways to handle file upload with GWT? Is it possible to do in with GWT-RPC or REST?



    Edit: Browser requirement is Only Webkit










    share|improve this question


























      1












      1








      1








      Uploading files with GWT is usually done with a FileUpload inside a FormPanel like this:



      // Create a FormPanel and point it at a service.
      final FormPanel form = new FormPanel();
      form.setAction("/myFormHandler");

      // Because we're going to add a FileUpload widget, we'll need to set the
      // form to use the POST method, and multipart MIME encoding.
      form.setEncoding(FormPanel.ENCODING_MULTIPART);
      form.setMethod(FormPanel.METHOD_POST);

      // Create a panel to hold all of the form widgets.
      VerticalPanel panel = new VerticalPanel();
      form.setWidget(panel);

      // Create a TextBox, giving it a name so that it will be submitted.
      final TextBox tb = new TextBox();
      tb.setName("textBoxFormElement");
      panel.add(tb);

      // Create a ListBox, giving it a name and some values to be associated with
      // its options.
      ListBox lb = new ListBox();
      lb.setName("listBoxFormElement");
      lb.addItem("foo", "fooValue");
      lb.addItem("bar", "barValue");
      lb.addItem("baz", "bazValue");
      panel.add(lb);

      // Create a FileUpload widget.
      FileUpload upload = new FileUpload();
      upload.setName("uploadFormElement");
      panel.add(upload);

      // Add a 'submit' button.
      panel.add(new Button("Submit", new ClickHandler()
      public void onClick(ClickEvent event)
      form.submit();

      ));


      Are there any other ways to handle file upload with GWT? Is it possible to do in with GWT-RPC or REST?



      Edit: Browser requirement is Only Webkit










      share|improve this question
















      Uploading files with GWT is usually done with a FileUpload inside a FormPanel like this:



      // Create a FormPanel and point it at a service.
      final FormPanel form = new FormPanel();
      form.setAction("/myFormHandler");

      // Because we're going to add a FileUpload widget, we'll need to set the
      // form to use the POST method, and multipart MIME encoding.
      form.setEncoding(FormPanel.ENCODING_MULTIPART);
      form.setMethod(FormPanel.METHOD_POST);

      // Create a panel to hold all of the form widgets.
      VerticalPanel panel = new VerticalPanel();
      form.setWidget(panel);

      // Create a TextBox, giving it a name so that it will be submitted.
      final TextBox tb = new TextBox();
      tb.setName("textBoxFormElement");
      panel.add(tb);

      // Create a ListBox, giving it a name and some values to be associated with
      // its options.
      ListBox lb = new ListBox();
      lb.setName("listBoxFormElement");
      lb.addItem("foo", "fooValue");
      lb.addItem("bar", "barValue");
      lb.addItem("baz", "bazValue");
      panel.add(lb);

      // Create a FileUpload widget.
      FileUpload upload = new FileUpload();
      upload.setName("uploadFormElement");
      panel.add(upload);

      // Add a 'submit' button.
      panel.add(new Button("Submit", new ClickHandler()
      public void onClick(ClickEvent event)
      form.submit();

      ));


      Are there any other ways to handle file upload with GWT? Is it possible to do in with GWT-RPC or REST?



      Edit: Browser requirement is Only Webkit







      java javascript gwt rpc gwt-rpc






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 '18 at 5:15









      Cœur

      18.3k9109148




      18.3k9109148










      asked Nov 30 '13 at 13:24









      confileconfile

      14.6k36150289




      14.6k36150289






















          1 Answer
          1






          active

          oldest

          votes


















          2














          With modern browsers you can get the raw bytes of the input type=file (in a base64 data url). Having the bytes you can send them whatever the way you like.



          Here's some code, displaying a file input dialog and getting the raw bytes (dataURL):



          class Util 
          static native void info (Object obj) /*-
          if ($wnd.console && $wnd.console.log) $wnd.console.log (obj)
          -*/;

          /** Fires a "click" event on an HTML element. */
          public static native void click (final JavaScriptObject element) /*-
          if (element.click) element.click();
          -*/;

          /** Read a file from the local filesystem. The file should have been choosen via an `input type=file`.
          * See also: http://www.html5rocks.com/ru/tutorials/file/dndfiles/; http://www.w3.org/TR/FileAPI/ */
          public static native void readFile (JavaScriptObject inputFile, V1<String> andThen) /*--*/;


          // Remove old form.
          final Element oldForm = Document.get().getElementById ("uploadForm");
          if (oldForm != null) oldForm.getParentNode().removeChild (oldForm);

          // A hidden form used to upload the files.
          final FormPanel form = new FormPanel();
          form.getElement().setId ("uploadForm");
          final Style formStyle = form.getElement().getStyle();
          formStyle.setDisplay (Display.INLINE_BLOCK); formStyle.setOverflow (Overflow.HIDDEN); formStyle.setWidth (0, Unit.PX); formStyle.setHeight (0, Unit.PX);
          form.setAction ("http://.../");
          form.setEncoding (FormPanel.ENCODING_MULTIPART); form.setMethod (FormPanel.METHOD_POST);
          final FileUpload upload = new FileUpload(); upload.setName ("image");
          form.add (upload);
          RootPanel.get().add (form);

          upload.addChangeHandler (new ChangeHandler() public void onChange (final ChangeEvent event)
          Util.info ("Loading: " + upload.getFilename());
          Util.readFile (upload.getElement(), new V1<String>() public void call (final String dataURL)
          Util.info ("Loaded: " + upload.getFilename() + " (url is " + dataURL.length() + " bytes)");
          );
          );

          // Trigger the upload dialogue. See also: http://aspalliance.com/articleViewer.aspx?aId=1441&pId=-1
          Util.click (upload.getElement());





          share|improve this answer























          • I think that you should use convertToBlob() instead of using the base64 format since it consumes less space. What do you think?

            – confile
            Nov 30 '13 at 14:23






          • 1





            You have the option to get an ArrayBuffer, see w3.org/TR/FileAPI/#dfn-filereader, but I used the data url because I wanted to display the image too (actually, to edit it with a canvas). And base64 is more familiar to me. What convertToBlob do you mean, BTW?

            – ArtemGr
            Nov 30 '13 at 14:30







          • 1





            I see. Check stackoverflow.com/a/6736250/257568. Well, not every RPC mechanism will handle a Blob, while passing the data url to the server is straightforward. BTW, while looking for convertToBlob I have found a github.com/blueimp/JavaScript-Canvas-to-Blob library and its peer the blueimp.github.io/JavaScript-Load-Image library which you might find useful.

            – ArtemGr
            Dec 2 '13 at 14:41







          • 1





            V1 is from this Closure library: raw.github.com/MSeifeddo/…; I guess the File API lets you bind the onprogress listener (w3.org/TR/FileAPI/#dfn-onprogress) which gets the Progress events explained here: w3.org/TR/progress-events; not used it myself (loads from the local filesystem tend to be very fast).

            – ArtemGr
            Dec 5 '13 at 17:56







          • 1





            Well, I'd use JSNI or Elemental (cf. gwtproject.org/articles/elemental.html). elemental.xml.XMLHttpRequest has setOnprogress. Wrap the onprogress-related code in a try-catch to gracefully handle the old browsers.

            – ArtemGr
            Dec 6 '13 at 14:17











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f20300772%2fuploading-files-through-gwt-rpc%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          With modern browsers you can get the raw bytes of the input type=file (in a base64 data url). Having the bytes you can send them whatever the way you like.



          Here's some code, displaying a file input dialog and getting the raw bytes (dataURL):



          class Util 
          static native void info (Object obj) /*-
          if ($wnd.console && $wnd.console.log) $wnd.console.log (obj)
          -*/;

          /** Fires a "click" event on an HTML element. */
          public static native void click (final JavaScriptObject element) /*-
          if (element.click) element.click();
          -*/;

          /** Read a file from the local filesystem. The file should have been choosen via an `input type=file`.
          * See also: http://www.html5rocks.com/ru/tutorials/file/dndfiles/; http://www.w3.org/TR/FileAPI/ */
          public static native void readFile (JavaScriptObject inputFile, V1<String> andThen) /*--*/;


          // Remove old form.
          final Element oldForm = Document.get().getElementById ("uploadForm");
          if (oldForm != null) oldForm.getParentNode().removeChild (oldForm);

          // A hidden form used to upload the files.
          final FormPanel form = new FormPanel();
          form.getElement().setId ("uploadForm");
          final Style formStyle = form.getElement().getStyle();
          formStyle.setDisplay (Display.INLINE_BLOCK); formStyle.setOverflow (Overflow.HIDDEN); formStyle.setWidth (0, Unit.PX); formStyle.setHeight (0, Unit.PX);
          form.setAction ("http://.../");
          form.setEncoding (FormPanel.ENCODING_MULTIPART); form.setMethod (FormPanel.METHOD_POST);
          final FileUpload upload = new FileUpload(); upload.setName ("image");
          form.add (upload);
          RootPanel.get().add (form);

          upload.addChangeHandler (new ChangeHandler() public void onChange (final ChangeEvent event)
          Util.info ("Loading: " + upload.getFilename());
          Util.readFile (upload.getElement(), new V1<String>() public void call (final String dataURL)
          Util.info ("Loaded: " + upload.getFilename() + " (url is " + dataURL.length() + " bytes)");
          );
          );

          // Trigger the upload dialogue. See also: http://aspalliance.com/articleViewer.aspx?aId=1441&pId=-1
          Util.click (upload.getElement());





          share|improve this answer























          • I think that you should use convertToBlob() instead of using the base64 format since it consumes less space. What do you think?

            – confile
            Nov 30 '13 at 14:23






          • 1





            You have the option to get an ArrayBuffer, see w3.org/TR/FileAPI/#dfn-filereader, but I used the data url because I wanted to display the image too (actually, to edit it with a canvas). And base64 is more familiar to me. What convertToBlob do you mean, BTW?

            – ArtemGr
            Nov 30 '13 at 14:30







          • 1





            I see. Check stackoverflow.com/a/6736250/257568. Well, not every RPC mechanism will handle a Blob, while passing the data url to the server is straightforward. BTW, while looking for convertToBlob I have found a github.com/blueimp/JavaScript-Canvas-to-Blob library and its peer the blueimp.github.io/JavaScript-Load-Image library which you might find useful.

            – ArtemGr
            Dec 2 '13 at 14:41







          • 1





            V1 is from this Closure library: raw.github.com/MSeifeddo/…; I guess the File API lets you bind the onprogress listener (w3.org/TR/FileAPI/#dfn-onprogress) which gets the Progress events explained here: w3.org/TR/progress-events; not used it myself (loads from the local filesystem tend to be very fast).

            – ArtemGr
            Dec 5 '13 at 17:56







          • 1





            Well, I'd use JSNI or Elemental (cf. gwtproject.org/articles/elemental.html). elemental.xml.XMLHttpRequest has setOnprogress. Wrap the onprogress-related code in a try-catch to gracefully handle the old browsers.

            – ArtemGr
            Dec 6 '13 at 14:17
















          2














          With modern browsers you can get the raw bytes of the input type=file (in a base64 data url). Having the bytes you can send them whatever the way you like.



          Here's some code, displaying a file input dialog and getting the raw bytes (dataURL):



          class Util 
          static native void info (Object obj) /*-
          if ($wnd.console && $wnd.console.log) $wnd.console.log (obj)
          -*/;

          /** Fires a "click" event on an HTML element. */
          public static native void click (final JavaScriptObject element) /*-
          if (element.click) element.click();
          -*/;

          /** Read a file from the local filesystem. The file should have been choosen via an `input type=file`.
          * See also: http://www.html5rocks.com/ru/tutorials/file/dndfiles/; http://www.w3.org/TR/FileAPI/ */
          public static native void readFile (JavaScriptObject inputFile, V1<String> andThen) /*--*/;


          // Remove old form.
          final Element oldForm = Document.get().getElementById ("uploadForm");
          if (oldForm != null) oldForm.getParentNode().removeChild (oldForm);

          // A hidden form used to upload the files.
          final FormPanel form = new FormPanel();
          form.getElement().setId ("uploadForm");
          final Style formStyle = form.getElement().getStyle();
          formStyle.setDisplay (Display.INLINE_BLOCK); formStyle.setOverflow (Overflow.HIDDEN); formStyle.setWidth (0, Unit.PX); formStyle.setHeight (0, Unit.PX);
          form.setAction ("http://.../");
          form.setEncoding (FormPanel.ENCODING_MULTIPART); form.setMethod (FormPanel.METHOD_POST);
          final FileUpload upload = new FileUpload(); upload.setName ("image");
          form.add (upload);
          RootPanel.get().add (form);

          upload.addChangeHandler (new ChangeHandler() public void onChange (final ChangeEvent event)
          Util.info ("Loading: " + upload.getFilename());
          Util.readFile (upload.getElement(), new V1<String>() public void call (final String dataURL)
          Util.info ("Loaded: " + upload.getFilename() + " (url is " + dataURL.length() + " bytes)");
          );
          );

          // Trigger the upload dialogue. See also: http://aspalliance.com/articleViewer.aspx?aId=1441&pId=-1
          Util.click (upload.getElement());





          share|improve this answer























          • I think that you should use convertToBlob() instead of using the base64 format since it consumes less space. What do you think?

            – confile
            Nov 30 '13 at 14:23






          • 1





            You have the option to get an ArrayBuffer, see w3.org/TR/FileAPI/#dfn-filereader, but I used the data url because I wanted to display the image too (actually, to edit it with a canvas). And base64 is more familiar to me. What convertToBlob do you mean, BTW?

            – ArtemGr
            Nov 30 '13 at 14:30







          • 1





            I see. Check stackoverflow.com/a/6736250/257568. Well, not every RPC mechanism will handle a Blob, while passing the data url to the server is straightforward. BTW, while looking for convertToBlob I have found a github.com/blueimp/JavaScript-Canvas-to-Blob library and its peer the blueimp.github.io/JavaScript-Load-Image library which you might find useful.

            – ArtemGr
            Dec 2 '13 at 14:41







          • 1





            V1 is from this Closure library: raw.github.com/MSeifeddo/…; I guess the File API lets you bind the onprogress listener (w3.org/TR/FileAPI/#dfn-onprogress) which gets the Progress events explained here: w3.org/TR/progress-events; not used it myself (loads from the local filesystem tend to be very fast).

            – ArtemGr
            Dec 5 '13 at 17:56







          • 1





            Well, I'd use JSNI or Elemental (cf. gwtproject.org/articles/elemental.html). elemental.xml.XMLHttpRequest has setOnprogress. Wrap the onprogress-related code in a try-catch to gracefully handle the old browsers.

            – ArtemGr
            Dec 6 '13 at 14:17














          2












          2








          2







          With modern browsers you can get the raw bytes of the input type=file (in a base64 data url). Having the bytes you can send them whatever the way you like.



          Here's some code, displaying a file input dialog and getting the raw bytes (dataURL):



          class Util 
          static native void info (Object obj) /*-
          if ($wnd.console && $wnd.console.log) $wnd.console.log (obj)
          -*/;

          /** Fires a "click" event on an HTML element. */
          public static native void click (final JavaScriptObject element) /*-
          if (element.click) element.click();
          -*/;

          /** Read a file from the local filesystem. The file should have been choosen via an `input type=file`.
          * See also: http://www.html5rocks.com/ru/tutorials/file/dndfiles/; http://www.w3.org/TR/FileAPI/ */
          public static native void readFile (JavaScriptObject inputFile, V1<String> andThen) /*--*/;


          // Remove old form.
          final Element oldForm = Document.get().getElementById ("uploadForm");
          if (oldForm != null) oldForm.getParentNode().removeChild (oldForm);

          // A hidden form used to upload the files.
          final FormPanel form = new FormPanel();
          form.getElement().setId ("uploadForm");
          final Style formStyle = form.getElement().getStyle();
          formStyle.setDisplay (Display.INLINE_BLOCK); formStyle.setOverflow (Overflow.HIDDEN); formStyle.setWidth (0, Unit.PX); formStyle.setHeight (0, Unit.PX);
          form.setAction ("http://.../");
          form.setEncoding (FormPanel.ENCODING_MULTIPART); form.setMethod (FormPanel.METHOD_POST);
          final FileUpload upload = new FileUpload(); upload.setName ("image");
          form.add (upload);
          RootPanel.get().add (form);

          upload.addChangeHandler (new ChangeHandler() public void onChange (final ChangeEvent event)
          Util.info ("Loading: " + upload.getFilename());
          Util.readFile (upload.getElement(), new V1<String>() public void call (final String dataURL)
          Util.info ("Loaded: " + upload.getFilename() + " (url is " + dataURL.length() + " bytes)");
          );
          );

          // Trigger the upload dialogue. See also: http://aspalliance.com/articleViewer.aspx?aId=1441&pId=-1
          Util.click (upload.getElement());





          share|improve this answer













          With modern browsers you can get the raw bytes of the input type=file (in a base64 data url). Having the bytes you can send them whatever the way you like.



          Here's some code, displaying a file input dialog and getting the raw bytes (dataURL):



          class Util 
          static native void info (Object obj) /*-
          if ($wnd.console && $wnd.console.log) $wnd.console.log (obj)
          -*/;

          /** Fires a "click" event on an HTML element. */
          public static native void click (final JavaScriptObject element) /*-
          if (element.click) element.click();
          -*/;

          /** Read a file from the local filesystem. The file should have been choosen via an `input type=file`.
          * See also: http://www.html5rocks.com/ru/tutorials/file/dndfiles/; http://www.w3.org/TR/FileAPI/ */
          public static native void readFile (JavaScriptObject inputFile, V1<String> andThen) /*--*/;


          // Remove old form.
          final Element oldForm = Document.get().getElementById ("uploadForm");
          if (oldForm != null) oldForm.getParentNode().removeChild (oldForm);

          // A hidden form used to upload the files.
          final FormPanel form = new FormPanel();
          form.getElement().setId ("uploadForm");
          final Style formStyle = form.getElement().getStyle();
          formStyle.setDisplay (Display.INLINE_BLOCK); formStyle.setOverflow (Overflow.HIDDEN); formStyle.setWidth (0, Unit.PX); formStyle.setHeight (0, Unit.PX);
          form.setAction ("http://.../");
          form.setEncoding (FormPanel.ENCODING_MULTIPART); form.setMethod (FormPanel.METHOD_POST);
          final FileUpload upload = new FileUpload(); upload.setName ("image");
          form.add (upload);
          RootPanel.get().add (form);

          upload.addChangeHandler (new ChangeHandler() public void onChange (final ChangeEvent event)
          Util.info ("Loading: " + upload.getFilename());
          Util.readFile (upload.getElement(), new V1<String>() public void call (final String dataURL)
          Util.info ("Loaded: " + upload.getFilename() + " (url is " + dataURL.length() + " bytes)");
          );
          );

          // Trigger the upload dialogue. See also: http://aspalliance.com/articleViewer.aspx?aId=1441&pId=-1
          Util.click (upload.getElement());






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 30 '13 at 14:18









          ArtemGrArtemGr

          7,60713463




          7,60713463












          • I think that you should use convertToBlob() instead of using the base64 format since it consumes less space. What do you think?

            – confile
            Nov 30 '13 at 14:23






          • 1





            You have the option to get an ArrayBuffer, see w3.org/TR/FileAPI/#dfn-filereader, but I used the data url because I wanted to display the image too (actually, to edit it with a canvas). And base64 is more familiar to me. What convertToBlob do you mean, BTW?

            – ArtemGr
            Nov 30 '13 at 14:30







          • 1





            I see. Check stackoverflow.com/a/6736250/257568. Well, not every RPC mechanism will handle a Blob, while passing the data url to the server is straightforward. BTW, while looking for convertToBlob I have found a github.com/blueimp/JavaScript-Canvas-to-Blob library and its peer the blueimp.github.io/JavaScript-Load-Image library which you might find useful.

            – ArtemGr
            Dec 2 '13 at 14:41







          • 1





            V1 is from this Closure library: raw.github.com/MSeifeddo/…; I guess the File API lets you bind the onprogress listener (w3.org/TR/FileAPI/#dfn-onprogress) which gets the Progress events explained here: w3.org/TR/progress-events; not used it myself (loads from the local filesystem tend to be very fast).

            – ArtemGr
            Dec 5 '13 at 17:56







          • 1





            Well, I'd use JSNI or Elemental (cf. gwtproject.org/articles/elemental.html). elemental.xml.XMLHttpRequest has setOnprogress. Wrap the onprogress-related code in a try-catch to gracefully handle the old browsers.

            – ArtemGr
            Dec 6 '13 at 14:17


















          • I think that you should use convertToBlob() instead of using the base64 format since it consumes less space. What do you think?

            – confile
            Nov 30 '13 at 14:23






          • 1





            You have the option to get an ArrayBuffer, see w3.org/TR/FileAPI/#dfn-filereader, but I used the data url because I wanted to display the image too (actually, to edit it with a canvas). And base64 is more familiar to me. What convertToBlob do you mean, BTW?

            – ArtemGr
            Nov 30 '13 at 14:30







          • 1





            I see. Check stackoverflow.com/a/6736250/257568. Well, not every RPC mechanism will handle a Blob, while passing the data url to the server is straightforward. BTW, while looking for convertToBlob I have found a github.com/blueimp/JavaScript-Canvas-to-Blob library and its peer the blueimp.github.io/JavaScript-Load-Image library which you might find useful.

            – ArtemGr
            Dec 2 '13 at 14:41







          • 1





            V1 is from this Closure library: raw.github.com/MSeifeddo/…; I guess the File API lets you bind the onprogress listener (w3.org/TR/FileAPI/#dfn-onprogress) which gets the Progress events explained here: w3.org/TR/progress-events; not used it myself (loads from the local filesystem tend to be very fast).

            – ArtemGr
            Dec 5 '13 at 17:56







          • 1





            Well, I'd use JSNI or Elemental (cf. gwtproject.org/articles/elemental.html). elemental.xml.XMLHttpRequest has setOnprogress. Wrap the onprogress-related code in a try-catch to gracefully handle the old browsers.

            – ArtemGr
            Dec 6 '13 at 14:17

















          I think that you should use convertToBlob() instead of using the base64 format since it consumes less space. What do you think?

          – confile
          Nov 30 '13 at 14:23





          I think that you should use convertToBlob() instead of using the base64 format since it consumes less space. What do you think?

          – confile
          Nov 30 '13 at 14:23




          1




          1





          You have the option to get an ArrayBuffer, see w3.org/TR/FileAPI/#dfn-filereader, but I used the data url because I wanted to display the image too (actually, to edit it with a canvas). And base64 is more familiar to me. What convertToBlob do you mean, BTW?

          – ArtemGr
          Nov 30 '13 at 14:30






          You have the option to get an ArrayBuffer, see w3.org/TR/FileAPI/#dfn-filereader, but I used the data url because I wanted to display the image too (actually, to edit it with a canvas). And base64 is more familiar to me. What convertToBlob do you mean, BTW?

          – ArtemGr
          Nov 30 '13 at 14:30





          1




          1





          I see. Check stackoverflow.com/a/6736250/257568. Well, not every RPC mechanism will handle a Blob, while passing the data url to the server is straightforward. BTW, while looking for convertToBlob I have found a github.com/blueimp/JavaScript-Canvas-to-Blob library and its peer the blueimp.github.io/JavaScript-Load-Image library which you might find useful.

          – ArtemGr
          Dec 2 '13 at 14:41






          I see. Check stackoverflow.com/a/6736250/257568. Well, not every RPC mechanism will handle a Blob, while passing the data url to the server is straightforward. BTW, while looking for convertToBlob I have found a github.com/blueimp/JavaScript-Canvas-to-Blob library and its peer the blueimp.github.io/JavaScript-Load-Image library which you might find useful.

          – ArtemGr
          Dec 2 '13 at 14:41





          1




          1





          V1 is from this Closure library: raw.github.com/MSeifeddo/…; I guess the File API lets you bind the onprogress listener (w3.org/TR/FileAPI/#dfn-onprogress) which gets the Progress events explained here: w3.org/TR/progress-events; not used it myself (loads from the local filesystem tend to be very fast).

          – ArtemGr
          Dec 5 '13 at 17:56






          V1 is from this Closure library: raw.github.com/MSeifeddo/…; I guess the File API lets you bind the onprogress listener (w3.org/TR/FileAPI/#dfn-onprogress) which gets the Progress events explained here: w3.org/TR/progress-events; not used it myself (loads from the local filesystem tend to be very fast).

          – ArtemGr
          Dec 5 '13 at 17:56





          1




          1





          Well, I'd use JSNI or Elemental (cf. gwtproject.org/articles/elemental.html). elemental.xml.XMLHttpRequest has setOnprogress. Wrap the onprogress-related code in a try-catch to gracefully handle the old browsers.

          – ArtemGr
          Dec 6 '13 at 14:17






          Well, I'd use JSNI or Elemental (cf. gwtproject.org/articles/elemental.html). elemental.xml.XMLHttpRequest has setOnprogress. Wrap the onprogress-related code in a try-catch to gracefully handle the old browsers.

          – ArtemGr
          Dec 6 '13 at 14:17




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f20300772%2fuploading-files-through-gwt-rpc%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

          Crossroads (UK TV series)

          ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế