用于图像上传的 PHP/JQuery 输入框


PHP/JQuery Input Boxes for an image upload

我目前正在处理多个 php 图像上传,但使用此站点我无法弄清楚,如果我可以将文件上传的输入从 3 个增加到 4 个? 我已经浏览了所有文件,但没有找到任何相关内容。以前有人使用过这个 SITE 示例可以帮助我吗?

Jquery

(function($) {
$(document).ready(function() {
    // it must be checked if there are div.imageForms because the
    // uploaderPreviewer javascript may be not included and produce an error
    if ($('div.imageForms').length) {
        $('div.imageForms').append($.uploaderPreviewer.createImageForms());
        // the images are populated if the admin form is to edit, and not
        // to insert
        if ($('div.imageForms[images]').length) {
            var imageFilenames = $('div.imageForms[images]').attr('images').split(',');
            $.uploaderPreviewer.populateImages(imageFilenames);
            $('div.imageForms[images]').removeAttr('images');
        }
    }
    $('#buttonSave').click(function() {
        var itemId = $(this).attr('itemId');
        if (itemId) {
            $.itemForm.update(itemId);
        }
        else {
            $.itemForm.insert();
        }
    });
});
})(jQuery);
</script>

.HTML

<html>
<div class="imageForms"></div>
    <div class="buttonSave">
        <button id="buttonSave">Upload</button>
    </div>
</div>
</html>

一旦 DOM 加载完毕,您就可以操作 $.uploaderPreviewer 对象选项。您所要做的就是:

$.uploaderPreviewer.formsCount = 4;

请参阅修订后的代码。