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

  • Home
  • SEARCH
  • 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 7886659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:22:29+00:00 2026-06-03T05:22:29+00:00

Below is the code where it is displaying the delete message but it is

  • 0

Below is the code where it is displaying the delete message but it is displaying it in each row, this is incorrect, it should on;y be displayed in the row the file was deleted from:

   var counter = 0;

function stopImageUpload(success, imagefilename){

      var result = '';
      counter++;

      if (success == 1){
         result = '<span class="imagemsg'+counter+'">The file was uploaded successfully!</span><br/><br/>';      
         $('.listImage').eq(window.lastUploadImageIndex).append('<div>' + htmlEncode(imagefilename) + '<button type="button" class="deletefileimage" image_file_name="' + imagefilename + '">Remove</button><br/><hr/></div>'); 
      }
      else {
         result = '<span class="imageemsg">There was an error during file upload!</span><br/><br/>';
      }


      $(".deletefileimage").on("click", function(event) {

         var image_file_name = $(this).attr('image_file_name');

    jQuery.ajax("deleteimage.php?imagefilename=" + image_file_name)
      .done(function(data) {
        $(".imagemsg" + counter).html(data);
       });

       $(this).parent().remove();

    });

      return true;   
}

The result variable is called here in the imageupload.php:

CALLBACK:

  <script language="javascript" type="text/javascript">window.top.stopImageUpload(<?php echo $result ? 'true' : 'false'; ?>, '<?php echo $_FILES['fileImage']['name'] ?>');</script>

Here is the link to the application here.

Please do this, click on the “Add” button twice, in both rows use the file inputs to upload an image. In both rows it will state that file upload was a success and it will display a name of both file at the bottom of their respective rows. Now delete a file by clicking on the delete button, you will see that the message (File was Deleted) is displayed in both rows, it should only be displayed within the row the file was deleted from

  • 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-03T05:22:30+00:00Added an answer on June 3, 2026 at 5:22 am

    Because you are initializing counter inside the function it will be a local variable, therefore the value will be ZERO every time. You need to initialize it outside of the function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why is the below code displaying the php code from msg.php? $flag = file('msg.php');
Below is the code where it is displaying the delete message ' $(.imagemsg +
When i'm displaying image from url with using below code, application is taking too
I am displaying two DIV panels with the code below. The only difference between
below code is my databasehandler class i got it from a tutorial. Beside that
The below code seems like it should work; however, the blob in the database
Below code is working properly now. But if I replace 'text.txt' with ' http://google.com
The below code works fine when i am not adding any extra row all
I used below code: var data = from query in loadedData.Descendants(chapter) select new CountryData
I'm trying to trim an exception message with the below code: Response.Redirect(IllegalCharactersError.aspx?error=); string message

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.