开发者

GWT FileUpload doesn't work on Chrome and Opera

开发者 https://www.devze.com 2023-02-12 15:33 出处:网络
Hi I have some appliacation written in GWT 2.2 (tested also on previuos versions) with file upload. Basicly there is FileUpload开发者_运维问答 component with Struts servlet on server side. The problem

Hi I have some appliacation written in GWT 2.2 (tested also on previuos versions) with file upload. Basicly there is FileUpload开发者_运维问答 component with Struts servlet on server side. The problem is that it works fine on IE and FF, but does not work on Chrome and Opera.

I found some tip to use gwtupload library ( i build the simplest case ) and the problem still occurs... With gwtupload I get alert with: "Error, your browser has not sent any information. Please try again or try it using another browser"

Simple code for gwtupload version:

   defaultUploader = new SingleUploader();
        verticalPanel.add(defaultUploader);
        defaultUploader.addOnFinishUploadHandler(onFinishUploaderHandler);

    // Load the image in the document and in the case of success attach it to the viewer
private IUploader.OnFinishUploaderHandler onFinishUploaderHandler = new IUploader.OnFinishUploaderHandler() {
    public void onFinish(IUploader uploader) {
      if (uploader.getStatus() == IUploadStatus.Status.SUCCESS) {

        //new PreloadedImage(uploader.fileUrl(), showImage);

        // The server can send information to the client.
        // You can parse this information using XML or JSON libraries
        //            Document doc = XMLParser.parse(uploader.getServerResponse());
        //            String size = IUploader.Utils.getXmlNodeValue(doc, "file-1-size");
        //            String type = IUploader.Utils.getXmlNodeValue(doc, "file-1-type");
        Window.alert("Upload work");
      }
    }
};

Deafult servlet on the serves side.

Again, it works only on FF and IE. I hope somebody faced similar problem. :)


It could be some nasty WebKit bug. I think to remember something about a problem uploading files with WebKit-based browsers on OS X. You may want to check the WebKit bug database.

0

精彩评论

暂无评论...
验证码 换一张
取 消