jquery uploadify, if empty
is imposible with jquery uploadify check if empty, when i push upload button? And if empty 开发者_如何学Pythonshow error.
Thanks
EDIT: When user push button "Upload Files" without marking anything file system must show errors (you must select, or etc.)
If you don't understand my problem please look this: http://img696.imageshack.us/img696/8854/erroruploadery.png
Edited (x2):
Something like this:
<script type="text/javascript">
var queueSize = 0;
function startUpload(){
if (queueSize == 0) {
alert("Please select a file first.");
} else {
$("#fileUpload").fileUploadStart();
}
}
</script>
<script type="text/javascript">
$("#fileUpload").fileUpload({
onCancel: function (a, b, c, d) {
queueSize = d.fileCount;
},
onClearQueue: function (a, b) {
queueSize = b.fileCount;
},
onSelectOnce: function (a, b) {
queueSize = b.fileCount;
},
onAllComplete: function () {
queueSize = 0;
},
onComplete: function (a, b ,c, d, e) {
queueSize = 0;
},
});
</script>
Which you would call with:
startUpload();
I did this in much simpler way. Add a div and associate it with uploadify 'queueId'
<asp:FileUpload name="fuFiles" ID="fuFiles" runat="server" />
<div id="fuItemsQueue" class="fuItemsQueue">
</div>
$("#<%=fuFiles.ClientID %>").uploadify({
'swf': '../Scripts/uploadify.swf',
'queueID': 'fuItemsQueue',
.....
});
Just on the OnCancel Event just count the number of Divs left.
'onCancel': function () {
var queueCount = $("#fuItemsQueue > div").size();
if (queueCount = 1) {
DisableUploadButtons();
}
}
And done!! :)
精彩评论