如何防止iPhone用户上传多个图片

时间:2014-04-29 19:12:59

标签: javascript jquery iphone plupload

我使用html5 / css / js构建应用程序,用户可以在div上传图像。在Android工作正常,用户点击链接,他可以选择要上传的图像。但是当我从iPhone中选择图像时,用户可以选择多个图像。如何让iPhone用户只选择一张图片?

我使用的是plupload插件,这里是js:

var uploader = new plupload.Uploader({
        browse_button: 'browse', // this can be an id of a DOM element or the DOM element itself
        url: 'upload.php',
        unique_names: true,
        filters: [{
            title: "Img type valid",
            extensions: "jpg"
        }],
        init: callbacks
    });

1 个答案:

答案 0 :(得分:1)

Ramon,你可以使用multi_selection = false

var uploader = new plupload.Uploader({
    browse_button: 'browse', // this can be an id of a DOM element or the DOM element itself
    url: 'upload.php',
    unique_names: true,
    multi_selection: false,
    filters: [{
        title: "Img type valid",
        extensions: "jpg"
    }],
    init: callbacks
});