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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:14:41+00:00 2026-06-12T09:14:41+00:00

I have an ajax file uploader plugin ( Max’s File Uploader ) where I

  • 0

I have an ajax file uploader plugin (Max’s File Uploader) where I copy and pasted the code and made some alterations.

Now below is a jQuery code where it measures if the file is successful, unsuccessful or cancelled:

function stopImageUpload(success, imagefilename){

  var result = '';
  imagecounter++;

  var replaceForm = function(result) { 
    $(sourceImageForm).find('.imagef1_upload_form').html(result + '<label>Image File: <input name="fileImage" class="fileImage" type="file"/></label><br/><br/><label><input type="submit" name="submitImageBtn" class="sbtnimage" value="Upload" /></label><label><input type="button" name="imageClear" class="imageClear" value="Clear File"/></label>');
  } 

  var updateForm = function(result) { 
    $(sourceImageForm).find('.imagef1_upload_form').find('.display_content_image').html(result);
  } 

  var displayInfo;

  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>'); 
    displayInfo = replaceForm;      
  }
  else if (success === 2){
    result = '<span class="imagemsg'+imagecounter+'"> The file upload was canceled</span><br/><br/>';
    displayInfo = updateForm;    
  }
  else {
    result = '<span class="imagemsg'+imagecounter+'">There was an error during file upload</span><br/><br/>';
    displayInfo = updateForm;  
  }
  displayInfo(result); 

)};

But I have a JavaScript function where it outputs this below in the PHP script:

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

What my question is, though, is that where it says ‘true’ or ‘false’ above, should this be 1 : 2 because I am measuring success of the files using numeric values and not string values?

  • 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-12T09:14:41+00:00Added an answer on June 12, 2026 at 9:14 am

    Instead of using true and false you can use 1 and 2.

      <script language="javascript" type="text/javascript">window.top.stopImageUpload(<?php echo $result ? 1 : 2; ?>, '<?php echo $_FILES['fileImage']['name'] ?>');</script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently been working on implementing an ajax based file uploader for my
With jQuery ajax method I have a request on some file, which returns data
I'm using plupload to make an ajax file uploading. Now the plupload.Uploader class has
so I have a PHP iframe (ajax) file uploader. I would like to display
I am using valums-file-uploader plugin. It allows me to upload files using ajax. I
I have a form that is generated via ajax based of a multi-file uploader
I have an ajax.php file in my Wordpress themes folder, and this was working
I have an AJAX function inside a javascript file and I want it to
I have an Ajax contact form that links to a jquery file but for
i have problem.. for(a=1;a<10;a++){ $(.div).append(<div id=+a+></div>) $.ajax({ url: file.php, data: a=+a, type: POST, async:

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.