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

How to prevent iPhone users upload more than one image

本文关键字:图像 何防止 iPhone 用户      更新时间:2023-09-26

我正在使用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
    });

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
});