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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:20:05+00:00 2026-06-02T21:20:05+00:00

I have an issue when it comes to deleting a file . I have

  • 0

I have an issue when it comes to deleting a file . I have an application [here][1].

To use the app, click on the “Add” button and a table row would appear which contains a file input. Please upload a couple of small files using the file input and clicking on the “Upload” button. Now you realise when you upload a file, the name of the file appears below within the table row and each file name contains it’s own “Delete” button.

Now the problem is lets say you want to delete a file name, when you click on the “Delete” button, it gets rid of all of the file names which is incorrect. It should only delete the file name you wanted to delete. Also after deleting a file name if you try and upload another file, the file name does not appear below.

So my question is that what is the correct way I should do this so that when the user deletes a file name, it only deletes the file name it is associated to and not all file names? After deleteing a file name when the user uploads another file, it should show the file name of that file.

Below is the code where the filename, delete button and horizontal line is appended in:

<ul class='listImage' align='left'>

Below is the javascript code:

function stopImageUpload(success, imagefilename){

      var result = '';

      if (success == 1){
         result = '<span class="msg">The file was uploaded successfully!</span><br/><br/>';      
         $('.listImage').append(htmlEncode(imagefilename) + '<button type="button" name="deletefileimage" class="deletefileimage">Delete</button><br/><hr/>'); 
      }
      else {
         result = '<span class="emsg">There was an error during file upload!</span><br/><br/>';
      }

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

        $(this).parents("form:first").find(".listImage").replaceWith("");

    });

      return true;   
}
  • 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-02T21:20:11+00:00Added an answer on June 2, 2026 at 9:20 pm

    What you should do is wrap each file/deletebutton in their own div and delete that div when the user presses delete.

    $('.listImage').append('<div>' + htmlEncode(imagefilename) + '<button type="button" name="deletefileimage" class="deletefileimage">Delete</button><br/><hr/><div>');
    

    And in the click event

    $(this).parent().remove();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an issue in my use of critical sections. My app has a
I have an issue using jquerys selectors when it comes to a page I
The current issue im facing is comes from the following scenario. I have a
I have come across an issue with my application, I have an option class
I've come across this issue in my application, and have reproduced it using Apple's
Do anyone come across a performance issue when deleting a first row in a
I just have a simple ASP Table seen here: <asp:Table ID=tblCategories runat=server CssClass=oneColTable padded-table
I have a weird issue that comes up while releasing an object. In the
I am facing a technical issue on a web-app development : Here is the
I have an issue. I have defined in C file, read-line.c, a function print,

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.