0

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 Answers 2

3

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();
Sign up to request clarification or add additional context in comments.

8 Comments

Thanks for replay, but if file is empty function don't go in: $("#fileInput2").uploadify({ });
You mean if the file you are uploading is empty, that event doesn't fire? What error are you getting?
I mean, if i don't select any file and push button Upload Files. I wish see error.
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
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?
|
0

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!! :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.