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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:51:26+00:00 2026-06-04T05:51:26+00:00

UPDATE: Right this is what I want for the solution. When the user clicks

  • 0

UPDATE:

Right this is what I want for the solution. When the user clicks on the “Cancel” button, it would try to find the file name of the file that is going to be cancelled and then delete the database row containing that file name.

The problem is that it is not recognizing the file name as it is stating that imagecancelname=undefined. As this is undefined, it can’t delete the database row containing the file name as it doesn’t recognise the name of the file.

So the question is that how can I get imagecancelname to recognise the name of the file which is going to be cancelled so then it can be used to be able to delete the database row containing the file name?

Below is the current form code:

var $fileImage = $("<form action='imageupload.php' method='post' enctype='multipart/form-data' target='upload_target' onsubmit='return startImageUpload(this);' class='imageuploadform' >" + 
  "Image File: <input name='fileImage' type='file' class='fileImage' /></label><br/><br/><label class='imagelbl'>" + 
  "<input type='submit' name='submitImageBtn' class='sbtnimage' value='Upload' /></label>" +     
  "</p><p class='imagef1_cancel' align='center'></p>" +
  "<iframe class='upload_target' name='upload_target' src='#' style='width:0;height:0;border:0px;solid;#fff;'></iframe></form>");

Below is the startImageUpload function where it displays the cancel button when file is uploading and where it contains the cancel button function if the user clicks on the Cancel button:

function startImageUpload(imagecancelname){

        $('.imagef1_cancel').eq(window.lastUploadImageIndex).html('<div><button type="button" class="imageCancel" image_cancel="' + imagecancelname + '">Cancel</button></div>'); 

            $('.imagef1_cancel').eq(window.lastUploadImageIndex).find(".imageCancel").on("click", function(event) {
                var image_cancel = $(this).attr('image_cancel');

              var url = 'cancelimage.php';
window.location=url+"?imagecancelname=" + image_cancel;

});       
      return true;
}

Finally below is the cancelimage.php script where when the user clicks on the Cancel button, it will navigate to this script and this is where the script is used to delete the database row by finding the file name using the $GET method.

    <?php

    ... connected to DB

    $image_cancel = $_GET["imagecancelname"];

            $imagecancelsql = "DELETE FROM Image 
            WHERE ImageFile = 'ImageFiles/". mysql_real_escape_string($image_cancel)."'";

        mysql_query($imagecancelsql);

        mysql_close();


?>
  • 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-04T05:51:28+00:00Added an answer on June 4, 2026 at 5:51 am

    In javascript you could just add an additional php file to delete a row from database.

    Add this in your js (when you delete):

    window.location=url+"?"+id;
    

    url = path where the php file is located

    id = the row id which you would like to delete

    Then add a php file to do the database operation

    <?php
        $imagecancelsql = "DELETE FROM Image 
                   WHERE ImageFile = 'ImageFiles/".
                   mysql_real_escape_string($_FILES['fileImage']['name'])."'";
        mysql_query($imagecancelsql);
    

    Id is a parameter which you need to pass as parameter from javascript.
    For example:
    If you would like to delete an image which has got an name black, then pass
    In Javascript:

    var image = 'black';
    window.location=url+"?id="+image;
    

    Later in the php file get the value of id using:

    $image = $_GET['id'];
    

    Then execute your query:

    $imagecancelsql = "DELETE FROM IMAGE WHERE IMAGEFILE = $image";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right guys, all autocomplete plugins and functions that I've found, they only update upon
This is what I want my site to do: 1. User fills in some
I want to design a webform that user should fill some fields. The value
I thought that there should have been a simple solution to this, given that
Imagine a database table that looks like this: create table [dbo].[user] ( id int
I need to accept arbitrary user input. Later, I want to copy that input,
Curious if I'm doing this right and if not how you guys would approach
The query: UPDATE node as n right join content_type_product as c on n.nid =
Is there a quick and easy way to update my LINQ dbml files? Right
Update: This does work, I was being stupid :( i have the following extension

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.