簡體   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