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 7976831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:00:58+00:00 2026-06-04T09:00:58+00:00

In my site I use 10 file upload boxes. I want to get a

  • 0

In my site I use 10 file upload boxes. I want to get a file upload box name when I click on the box.

That means first upload box, second upload box, third upload box etc…

So if I click on the first upload box then I want to get name of that file upload box.

How can i get the upload button name in ajax function.

This is my ajax code:

$(function(){
    var countfile = 10;
    var strfileid = '';


    for(i=1;i<=countfile;i++){
    var btnUpload=$('#browse'+i);

    var adinfoid=$('#adinfoid').val();
    new AjaxUpload(btnUpload, {
        action: '<?php echo base_url()?>index.php/post/upload_editgalleryimage/'+adinfoid,
        name: 'uploadfile',
        onSubmit: function(file, ext){
        alert(btnUpload.Name);
            var photoplancnt=$('#photoplancnt').val();
            var hidcountimg=$('#hidcountimg').val();
            if(parseInt(hidcountimg)>=parseInt(photoplancnt)){
                $("#photoerror").html('maximum '+photoplancnt +' files are allowed');
                $("#photoerror").css('display','block');
                return false;
            }
            if (! (ext && /^(jpg|png|jpeg|gif|JPG|PNG|JPEG|GIF)$/.test(ext))){
                $("#photoerror").html('Only JPG, PNG, GIF, files are allowed');
                $("#photoerror").css('display','block');
                return false;
            }           
        },
        onComplete: function(file, response){ 

            if(response){                   
                    $(".upload_main_div").html('');
                    $(".upload_main_div").html(response);

                    var insid = $("#hiddengalidnow").val();
                    calltoloadimage(insid);
                    /*$("#galimageicon").attr("src",response);  
                    $("#galimageicon").attr("width",55);
                    $("#galimageicon").attr("height",55);*/
                    //$("#mainimageicon1").attr("src",response);

            }else{
            alert("error");
            }
        }
    }); 
    }
});

It will alert ‘browse12’ at all time.

Html code:

<?php
for($i=1;$i<=10;$i++){
?>
<input type="button" id="browse<?php echo $i;?>" name ="browse<?php echo $i;?>" class="browse_media" value="Browse">
<?php
}
?>
  • 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-04T09:01:00+00:00Added an answer on June 4, 2026 at 9:01 am

    Finally

    alert(this._button.name);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a site that makes use of GET variables to determine what to
here is a site http://www.lyrkjsw.gov.cn that can let the registered user to upload file
I use plupload with html5. I try to upload file from cross-domain site. File
I have a site in cakephp 2 and I want to upload a file
I have a contest entry site that requires a file upload to an external
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
Hi I have a site where I use a User Table. I want to
I have an ASP.NET MVC 3 site that makes use of a ClientDependency framework
im trying to use a file upload control from the obout control library, i
I am attempting to use the Jquery file upload addon to asynchronously upload files

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.