繁体   English   中英

上传后输入文件为空

[英]Input file empty after upload

我正在使用一些jquery文件上传插件 我可以从桌面上传一些文件(如相关站点上的演示所示),但是当我必须验证表单时, input文件为空。 怎么可能 ?

我有点像

<button class="add-on" type="button"><?php echo _('Add...') ?></button>
<input type="file" class="input-file-upload" name="image" size="40" />

点击button ,我添加了一个文件,然后使用

$('#fileupload').fileupload({
                    // Uncomment the following to send cross-domain cookies:
                    //xhrFields: {withCredentials: true},
                    url: 'myurl',
                    progressall: function (e, data) {
                        var progress = parseInt(data.loaded / data.total * 100, 10);
                        $('#progress .bar').css(
                            'width',
                            progress + '%'
                        );
                    }
                });

从我的桌面上传完成后,我使用button type="submit"

这是两个基本选项,您可以在其中检查输入控件是否具有文件,然后继续执行想要的操作。

.bind('fileuploadadd', function (e, data) 
{
/*Check here whether the user selected file or not*/
})
.bind('fileuploadsubmit', function (e, data) 
{
 /*Check here whether the user selected file or not before submitting your form*/
})

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM