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

The Archive Base Latest Questions

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

I have a web programming question which I need to deal with which is

  • 0

I have a web programming question which I need to deal with which is below:

“You are passing the form element to the startImageUpload() function, and attempting to store it as a string in the HTML you add to the imagef1_cancel element. This will not work. You need to give each form a unique id, and use this string to identify the upload that needs to be cancelled.”

At the moment it cannot recognize the file it wants to delete from the row when clicking on a cancel button. Below is what the var_dump($GET) and the print($imagecancelsql) is showing:

Notice: Undefined index: imagecancelname in /xxx/Mobile_app/cancelimage.php on line 22
array(0) { } DELETE FROM Image WHERE ImageFile = ‘ImageFiles/’

So how can the problem be sorted out so that it can identify the file string of the upload that needs to be cancelled?

Below is my current attempt in trying to solve this:

 var sourceImageForm; 

         function startImageUpload(imageuploadform, imagecancelname){

  $(imageuploadform).find('.imagef1_upload_process').css('visibility','visible');
  $(imageuploadform).find('.imagef1_cancel').css('visibility','visible');
  $(imageuploadform).find('.imagef1_upload_form').css('visibility','hidden');
  sourceImageForm = imageuploadform;

/*The above would show and hide elements within the form the file is being uploaded.
For example if I have three forms and the second form is uploading a file, then it
shows and hides the elements within the second form only */

        $(imageuploadform).find('.imagef1_cancel').html('<div><button type="button" class="imageCancel" id="image_cancel_' + imagecancelname + '">Cancel</button></div>').find(".imageCancel").on("click", function(event) {
        $.ajax("cancelimage.php?imagecancelname=" + $(this).attr('id').slice(13));

});       
      return true;
}

Below is the 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>");

Finally below is the cancelimage.php where it is suppose to delete the db row containing the file name:

   <?php

      // ... connected to DB

$image_cancel = '';
if (isset($_GET["imagecancelname"])) { $image_cancel = $_GET["imagecancelname"]; }

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

      print $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-04T11:37:01+00:00Added an answer on June 4, 2026 at 11:37 am
    Notice: Undefined index: imagecancelname
    

    You can get rid of this notice, when checking for existence of this GET index:

    $image_cancel = '';
    if (isset($_GET["imagecancelname"])) { $image_cancel = $_GET["imagecancelname"]; }
    
    
    // This line is only asking what that underscore is good for (typo?)
    // $image_cancel_ = $_GET["imagecancelname"];
                    ^
                    |
                  ? ? ?
    

    Later on you should only continue, if $image_cancel is set to something useful and(!) allowed (never trust user input and do proper validation).

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

Sidebar

Related Questions

I have web page which is passing a querystring parameter to page 2: <a
Pardon the dumb newbie question here; web programming isn't my forte... (blush) I have
I have been in web programming for 2 years (Self taught - a biology
I have till now mainly concentrated on web programming thus far and now want
I have a very basic knowledge of the web programming, and I couldn't figure
I am new to web programming...I have been asked to create a simple Internet
I'm new to Django and Web programming in general. Have googled but could not
I have built Web sites with Python/Django and desktop applications with Objective-C/Cocoa so programming
I have web service, which use integrated security in IIS. Now, I want to
I have web page in PHP which displays all records in a table. I

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.