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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:44:47+00:00 2026-05-14T02:44:47+00:00

Below is my entire code from a User control that contains the YUI Uploader.

  • 0

Below is my entire code from a User control that contains the YUI Uploader. Is there something I’m missing. Right now, when I step through the javascript code in Firebug, it hangs on the first line of the upload() function. I have a breakpoint on the first line of the ashx that handles the file, but it is never called. So, it doesn’t get that far. I figure I’m just missing something stupid. I’ve used this control many times before with no issues. I’m using all the css files and graphics provided by the samples folder in the YUI download.

If I’m not missing anything, is there a more comprehensive way of debuging this issue then through stepping through the javascript with FireBug. I’ve tried turning the logging for YUI on and off, and never get any logs anywhere. I’m not sure where to go now.

<style type="text/css">
   #divFile
   {
        background-color:White;
        border:2px inset Ivory;
        height:21px;
        margin-left:-2px;
        margin-right:9px;
        width:125px;
   }
</style>
<ajaxToolkit:RoundedCornersExtender runat="server" Corners="All" Radius="6" ID="rceContainer" TargetControlID="pnlMMAdmin" />
<asp:Panel ID="pnlMMAdmin" runat="server" 
 Width="100%" BackColor="Silver" ForeColor="#ffffff" Font-Bold="true" Font-Size="16px">
<div style="padding: 5px; text-align:center; width: 100%;">

<table style="width: 100% ; border: none; text-align: left;">
    <tr>
    <td style="width: 460px; vertical-align: top;">
        <!-- information panel -->
        <ajaxToolkit:RoundedCornersExtender runat="server" Corners="All" Radius="6" ID="RoundedCornersExtender1" TargetControlID="pnlInfo" />
        <asp:Panel ID="pnlInfo" runat="server" 
         Width="100%" BackColor="Silver" ForeColor="#ffffff" Font-Bold="true" Font-Size="16px">
        <div id="infoPanel" style="padding: 5px; text-align:left; width: 100%;">
        <table>
        <tr><td>Chart</td><td>
        <table><tr><td><div id="divFile" ></div></td><td><div id="uploaderContainer" style="width:60px; height:25px"></div></td></tr>
        <tr><td colspan="2"><div id="progressBar"></div></td></tr></table>
</td></tr>

    </table>

</div></asp:Panel>
<script type="text/javascript" language="javascript">
    WYSIWYG.attach('<%= txtComment.ClientID %>', full);
    var uploader = new YAHOO.widget.Uploader("uploaderContainer", "assets/buttonSkin.jpg");
    uploader.addListener('contentReady', handleContentReady);
    uploader.addListener('fileSelect', onFileSelect)
    uploader.addListener('uploadStart', onUploadStart);
    uploader.addListener('uploadProgress', onUploadProgress);
    uploader.addListener('uploadCancel', onUploadCancel);
    uploader.addListener('uploadComplete', onUploadComplete);
    uploader.addListener('uploadCompleteData', onUploadResponse);
    uploader.addListener('uploadError', onUploadError);
    function handleContentReady() {
        // Allows the uploader to send log messages to trace, as well as to YAHOO.log
        uploader.setAllowLogging(false);

        // Restrict selection to a single file (that's what it is by default,
        // just demonstrating how).
        uploader.setAllowMultipleFiles(false);

        // New set of file filters.
        var ff = new Array({ description: "Images", extensions: "*.jpg;*.png;*.gif" });

        // Apply new set of file filters to the uploader.
        uploader.setFileFilters(ff);
    }
    var fileID;
    function onFileSelect(event) {
        for (var item in event.fileList) {
            if (YAHOO.lang.hasOwnProperty(event.fileList, item)) {
                YAHOO.log(event.fileList[item].id);
                fileID = event.fileList[item].id;
            }
        }
        uploader.disable();

        var filename = document.getElementById("divFile");
        filename.innerHTML = event.fileList[fileID].name;

        var progressbar = document.getElementById("progressBar");
        progressbar.innerHTML = "Please wait... Starting upload.... ";
        upload(fileID);
    }
    function upload(idFile) {
        // file hangs right here. **************************
        progressBar.innerHTML = "Upload starting... ";
        if (idFile != null) {

            uploader.upload(idFile, "AdminFileUploader.ashx", "POST");
            fileID = null;
        }
    }
    function handleClearFiles() {
        uploader.clearFileList();
        uploader.enable();
        fileID = null;

        var filename = document.getElementById("divFile");
        filename.innerHTML = "";

        var progressbar = document.getElementById("progressBar");
        progressbar.innerHTML = "";
    }
    function onUploadProgress(event) {
        prog = Math.round(300 * (event["bytesLoaded"] / event["bytesTotal"]));
        progbar = "<div style=\"background-color: #f00; height: 5px; width: " + prog + "px\"/>";

        var progressbar = document.getElementById("progressBar");
        progressbar.innerHTML = progbar;
    }
    function onUploadComplete(event) {
        uploader.clearFileList();
        uploader.enable();

        progbar = "<div style=\"background-color: #f00; height: 5px; width: 300px\"/>";
        var progressbar = document.getElementById("progressBar");
        progressbar.innerHTML = progbar;
        alert('File Uploaded');
    }

    function onUploadStart(event) {
        alert('upload start');
    }

    function onUploadError(event) {
        alert('upload error');
    }

    function onUploadCancel(event) {
        alert('upload cancel');
    }

    function onUploadResponse(event) {
        alert('upload response');
    }

</script>
  • 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-05-14T02:44:47+00:00Added an answer on May 14, 2026 at 2:44 am

    It seems that there is a case mismatch in the name of the progressbar variable: you refer to it as progressbar everywhere else, but as progressBar in the upload() function.

    An even bigger problem is that you define the progressbar variable inside the onFileSelect function. Because of that, the variable is limited in scope and should not be accessible anywhere else.

    See if moving the definition for progressbar out of there (or freshly grabbing it from the DOM everywhere it’s used by using getElementById) and fixing the case mismatch solves your issues.

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

Sidebar

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.