views:

56

answers:

1

Hi, is imposible with jquery uploadify check if empty, when i push upload button? And if empty show 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

+2  A: 

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();
Whit
Thanks for replay, but if file is empty function don't go in:$("#fileInput2").uploadify({ });
lolalola
You mean if the file you are uploading is empty, that event doesn't fire? What error are you getting?
Whit
I mean, if i don't select any file and push button Upload Files. I wish see error.
lolalola
I've edited the answer above.
Whit
Thank you, but I have now done so. I want when pressed send button without marking anything notified to report user (you must select, or etc. ). I hope to understand my problem
lolalola
What I am saying is that you don't need a send button at all. Only a browse. Do you have a demo we could look at?
Whit
If you don't understand my problem please look this:http://img696.imageshack.us/img696/8854/erroruploadery.png
lolalola
Updated the above answer.
Whit
Thank you very much ;). But i put in my code, and this don't work and i don't no way. if not very hard, maybe to show that the full sample. Thanks
lolalola
I've been trying to help you now for ages, without so much as an up-vote.
Whit