Scala Lift - AJAX uploader (valums) not accepting IE9 file upload

I have the following:

new qq.FileUploader({

    element: $('#' + domid + ' #upload')[0],
    action: '/api/panel/upload_file',
    debug: true,
    allowedExtensions: [

        'jpg',
        'jpeg',
        'gif',
        'png',
        'bmp',
        'pdf'

    ],
    params: {

        room : 'a_room',
        module : 'a_module'

    },
    onSubmit: function(id, fileName) {

        this.params.name = fileName;

    },
    onProgress: function(id, fileName, loaded, total) { },
    onComplete : function(id, fileName, data) {

        /* FINISH */

    }

});

Which sends the upload request to:

case "api" :: "panel" :: "upload_file" :: Nil Post req => {

    var response = true

    req.body match {

        case Full(file) => 

            /* DO SOMETHING */

        case _ => response = false

    }

}

This works fine in both Firefox and Chrome, but when uploading with IE9 the file doesnt seem to get past:

req.body match {

    case Full(file) =>

}

Is there something I'm missing or need to do to get this working properly?

Thanks in advance for any help, much appreciated :)

Answers


Firstly, req.body will give you an array of bytes, not a file. Lift will automatically detect if you're uploading a file or an arbitrary payload. Its not a good idea to put files into memory, especially if they might be large.

Look into req.uploadedFiles, and req.rawInputStream with OnDiskFileParamHolder.apply - if i recall how vallums uploader works, you have to manually push the input stream into the FileParamHolder, from which you can just call .file and then have a direct java.io.File instance to work with.


Need Your Help

running process does not follow system time

c linux time timezone

Consider the following program that does nothing except print the time once a minute.

is_page_template checking in the included file

wordpress templates

I need to check if my custom page template is index-with-sidebar.php