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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:32:16+00:00 2026-06-03T22:32:16+00:00

I have a php script below known as cancelimage.php where it will display a

  • 0

I have a php script below known as cancelimage.php where it will display a cancel message:

<?php

$image_file_name = $_GET["imagefilename"];

    echo "$image_file_name Upload was Canceled";


?>

The problem is that when I click on the “Cancel” button, it does not display this message. Instead it displays the message “There was a error during file upload”. I believe the reason this message is coming up instead is because I am stating “return stopImageUpload”.

So what my question is that how can I return to stopImageUpload like I am doing now, but instead be able to display the cancel message instead of the message it is displaying now?

Below is my current attempt on trying to fix this but which has failed. Below shows both the cancel button function and the stopImageUpload function:

var cancelimagecounter = 0;
function startImageUpload(imageuploadform, imagefilename) {
    cancelimagecounter++;
    var _cancelimagecounter = cancelimagecounter;
    $('.imageCancel').on("click", function (event) {
        $('.upload_target').get(0).contentwindow
        $("iframe[name='upload_target']").attr("src", "javascript:'<html></html>'");
        jQuery.ajax("cancelimage.php?imagefilename=" + image_file_name).done(function (data) {
            $(".imageemsg" + _cancelimagecounter).html(data);
        });
        return stopImageUpload();
    });
    return true;
}
var imagecounter = 0;
function stopImageUpload(success, imagefilename) {
    var result = '';
    if (success == 1) {
        result = '<span class="imagemsg' + imagecounter + '">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/>';
    }
    return true;
}

Below is the cancel button which is suppose to retrieve a file name from the DOM:

<input type='button' name='imageCancel' class='imageCancel' image_file_name='" + imagefilename + "' value='Cancel' />
  • 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-03T22:32:16+00:00Added an answer on June 3, 2026 at 10:32 pm

    The problem seems to be this:

        if (success == 1) {
    

    And this:

    return stopImageUpload();
    

    stopImageUpdate has 2 params – first being success if you call without success will be undefined (not 1). Fix might look like this:

    return stopImageUpload(0, image_file_name); 
    

    And in your stopImageUpload change the else to something like:

    result = '<span class="imageemsg">' + image_file_name + ' Upload Was Cancelled!</span><br/><br/>';
    

    HTH

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

Sidebar

Related Questions

I have a php script below known as cancelimage.php where it will display a
I have a small script which im using to test PHP mail(), as below:
I have a PHP script running on XAMPP in Windows XP that will open
I have a php script that will an catch email passed to it and
I have programmed a proxy.php script (listed below), which would fetch an image specified
I have a PHP script (pasted below) which pulls in meta data from a
I have php script that creates a temporary watermark image for users that are
I have a PHP script that executes a .bat file using system(cmd /c C:\dir\file.bat);
I have a PHP script (news-generator.php) which, when I include it, grabs a bunch
I have a php script that backup my table in .sql format and 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.