Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7828707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:27:08+00:00 2026-06-02T10:27:08+00:00

When user add a file into queue I must validate so I wrote a

  • 0

When user add a file into queue I must validate so I wrote a function in callback:

$(document).ready( function() {
$('#fileupload').bind('fileuploadadd', function (e, data) {
    $.each(data.files, function (index, file) {
        check = ValidaDoc(file.name);
        if (check!="OK"){
            var erro="";
            if (check=="Alerta1"){
                alert("Alerta1");
            }
            else {
                errotemp="";
                if(check=="Erro1"){erro=erro + file.name + " com extensão não esperada.";}
                else if(check=="Erro2"){erro=erro + file.name + " não cadastrado ou com nome fora do padrão.";}
                $($('#fileupload .files .cancel button')[index]).click();
        }
    }
});
});

The callback works, the ValidaDoc function works and a file is canceled but not the right one. I think the index use is no right. Anyone have a ideia?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T10:27:09+00:00Added an answer on June 2, 2026 at 10:27 am

    The problem was my misunderstaning of the index. I replace the line that calls click with the one bellow and all works fine.

    $($('#fileupload .files .cancel button')[data.context[index].rowIndex]).click();
    

    I have to change the event too. When the fileuploadadd is called the file is not in the table yet. So changed to fileuploadded.

    $('#fileupload').bind('fileuploadadded', function (e, data) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page where the user can dynamically add file upload boxes. Adding
I've created an Console application project then add new App.conf file into my project.
Application is running in my local system app.config file <add key=dbconn value=Data Source=(local);database=VTech;User ID=sa;Password=sa;
I am letting the user add events to the calendar in my app. My
I am developing an app whenever a user add some details the record get
In visual studio, when user Add Reference, another dialog box will be pop out
Is there a plugin for Aloha Editor that would let the user add audio/video
I am using Flexigrid in my web App.When user add or delete a record,the
In my application user can add there reminder for the specific day and reminder
Our application allows administrators to add User Properties in order for them to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.