Page view counter

javascript and FileUpload

Last post 05-11-2008 10:52 PM by hlopezrd. 2 replies.

Sort Posts:

  • javascript and FileUpload

    05-11-2008, 6:23 PM
    • Loading...
    • hlopezrd
    • Joined on 12-14-2006, 10:18 AM
    • Posts 3
    • Points 0

    Hi to all,

    I have the following code:

     ...

    <script language="javascript" type="text/javascript">
    // <!CDATA[

    function btnTest_onclick() {
          var f = document.forms[0];
          var fn = f.FileUpload1.FileName;
          alert(fn);
          // Create an iframe.
          var iframe = document.createElement("iframe");
         
          // Point the iframe to the location of
          //  the long running process.
          iframe.src = "Test2.aspx";
         
          // Make the iframe invisible.
          iframe.style.display = "none";
         
          // Add the iframe to the DOM.  The process
          //  will begin execution at this point.
          document.body.appendChild(iframe);
         
          // Disable the button and blur it.
          document.getElementById('trigger').disabled = true;
          document.getElementById('trigger').blur();
        }
    // ]]>
    </script>

    ...

    <form id="form1" runat="server">
        <div>
            <asp:FileUpload ID="FileUpload1" runat="server" Style="z-index: 100; left: 8px; position: absolute;
                top: 9px" Width="470px" />
            &nbsp;<br />
            <input id="btnTest" style="z-index: 102; left: 10px; width: 465px; position: absolute;
                top: 36px" type="button" value="Begin Work" onclick="return btnTest_onclick()" />
        </div>
        </form>

    That I want to do is when I press input button (btnTest) save file in the FileUpload control, then execute the code in the javascript funcion (btnTest_onclick).

    Can I do that? how? if no, please point me in another idea

    thanks in advance

  • Re: javascript and FileUpload

    05-11-2008, 6:34 PM
    • Loading...
    • albertpascual
    • Joined on 05-23-2003, 10:11 AM
    • Riverside, CA
    • Posts 3,471
    • Points 17,404

    Why adding javascript on the fileupload control, once you post it to the server, javascript cannot access the file

    Cheers
    Al
    My Blog
    MapStats.NET
    Please click on 'Mark as Answer' if this post answered your question!
  • Re: javascript and FileUpload

    05-11-2008, 10:52 PM
    • Loading...
    • hlopezrd
    • Joined on 12-14-2006, 10:18 AM
    • Posts 3
    • Points 0

    Hi,

    Only I want save file in my server.

    The javascript call a page that do many jobs and one of this jobs is process the file that I upload to the server from DTS

    If you can tell me another way, I take it.

    Thanks. 

Page 1 of 1 (3 items)