Loading ...
Sorry, an error occurred while loading the content.

Re: File upload in dialog doesn't work

Expand Messages
  • tssha
    ... pull ... What s ... Please post a URL or sample code for us to review. Regards, Thomas
    Message 1 of 5 , Mar 2 8:19 AM
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, Ken Loomis <kloomis@...> wrote:
      >
      > Hello:
      >
      > Is it a bug, a feature, or am I doing something wrong? I have a form
      > with an input of file type in a YUI dialog. When I submit the form for
      > uploading using a submit button on the form (not one of the dynamically
      > built buttons, and not using AJAX) the upload does not happen. If I
      pull
      > the form off the dialog and put it on the page, the upload works.
      What's
      > wrong?
      >
      > Thanks,
      >
      > Ken

      Please post a URL or sample code for us to review.

      Regards,
      Thomas
    • Ken Loomis
      ... I m reluctant to post a URL since this is an upload script, but here s the code:
      Message 2 of 5 , Mar 2 11:16 AM
      • 0 Attachment
        tssha wrote:
        > --- In ydn-javascript@yahoogroups.com, Ken Loomis <kloomis@...> wrote:
        >
        >> Hello:
        >>
        >> Is it a bug, a feature, or am I doing something wrong? I have a form
        >> with an input of file type in a YUI dialog. When I submit the form for
        >> uploading using a submit button on the form (not one of the dynamically
        >> built buttons, and not using AJAX) the upload does not happen. If I pull the form off the dialog and put it on the page, the upload works. What's wrong?
        >>
        > Please post a URL or sample code for us to review.
        I'm reluctant to post a URL since this is an upload script, but here's the code:


        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml" lang="ENG" xml:lang="ENGLISH">
        <head>
        <title>Upload Test</title>

        <style type="text/css"> @import url("pwstyle.css");</style>
        <script type="text/javascript"
        src="../yuilib/build/yahoo/yahoo.js"></script>
        <script type="text/javascript" src="../yuilib/build/dom/dom.js"></script>
        <script type="text/javascript"
        src="../yuilib/build/event/event.js"></script>
        <script type="text/javascript"
        src="../yuilib/build/container/container.js"></script>
        <link rel="stylesheet" type="text/css"
        href="../yuilib/build/container/assets/container.css">
        <link rel="stylesheet" type="text/css"
        href="../yuilib/build/fonts/fonts.css">
        <script type="text/javascript"
        src="../yuilib/build/connection/connection.js"></script>
        <script type="text/javascript"
        src="../yuilib/build/dragdrop/dragdrop.js"></script>
        <script type="text/javascript"
        src="../yuilib/build/animation/animation.js"></script>
        <script type="text/javascript">
        function init() {
        YAHOO.widget.dialogUploadFile = new YAHOO.widget.Dialog("dialogUpload",
        { width : "400px",
        fixedcenter : true,
        visible : false,
        constraintoviewport : true,
        buttons : [ { text:"Close", handler:handleCancel } ]
        } );

        YAHOO.widget.dialogUploadFile.render();
        }

        var handleCancel = function() {
        this.cancel();
        }

        YAHOO.util.Event.addListener(window, "load", init);

        function uploadFile() {
        YAHOO.widget.dialogUploadFile.show();
        }
        </script>
        </head>
        <body>

        <div id="functionButtons">
        <button onclick="uploadFile()">Upload file</button>
        </div>

        <div id="dialogUpload">
        <div class="hd">Upload file</div>
        <div class="bd">
        <form enctype="multipart/form-data" method="post"
        action="uploadTest.php" >
        <input type='file' name='fileName' ><br /><br />
        <input type='submit' value="Upload now">
        </form>
        </div>
        </div>

        </body>
        </html>
      • Ken Loomis
        Is it a bug, a feature, or am I doing something wrong? I have a form
        Message 3 of 5 , Mar 5 10:13 AM
        • 0 Attachment
          Is it a bug, a feature, or am I doing something wrong? I have a form
          >>> with an input of file type in a YUI dialog. When I submit the form for
          >>> uploading using a submit button on the form (not one of the dynamically
          >>> built buttons, and not using AJAX) the upload does not happen. If I pull the form off the dialog and put it on the page, the upload works. What's wrong?
          >> Please post a URL or sample code for us to review.

          >> Here's the code:
          >>
          >>
          >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
          >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
          >> <html xmlns="http://www.w3.org/1999/xhtml" lang="ENG" xml:lang="ENGLISH">
          >> <head>
          >> <title>Upload Test</title>
          >>
          >> <style type="text/css"> @import url("pwstyle.css");</style>
          >> <script type="text/javascript"
          >> src="../yuilib/build/yahoo/yahoo.js"></script>
          >> <script type="text/javascript" src="../yuilib/build/dom/dom.js"></script>
          >> <script type="text/javascript"
          >> src="../yuilib/build/event/event.js"></script>
          >> <script type="text/javascript"
          >> src="../yuilib/build/container/container.js"></script>
          >> <link rel="stylesheet" type="text/css"
          >> href="../yuilib/build/container/assets/container.css">
          >> <link rel="stylesheet" type="text/css"
          >> href="../yuilib/build/fonts/fonts.css">
          >> <script type="text/javascript"
          >> src="../yuilib/build/connection/connection.js"></script>
          >> <script type="text/javascript"
          >> src="../yuilib/build/dragdrop/dragdrop.js"></script>
          >> <script type="text/javascript"
          >> src="../yuilib/build/animation/animation.js"></script>
          >> <script type="text/javascript">
          >> function init() {
          >> YAHOO.widget.dialogUploadFile = new YAHOO.widget.Dialog("dialogUpload",
          >> { width : "400px",
          >> fixedcenter : true,
          >> visible : false,
          >> constraintoviewport : true,
          >> buttons : [ { text:"Close", handler:handleCancel } ]
          >> } );
          >>
          >> YAHOO.widget.dialogUploadFile.render();
          >> }
          >>
          >> var handleCancel = function() {
          >> this.cancel();
          >> }
          >>
          >> YAHOO.util.Event.addListener(window, "load", init);
          >>
          >> function uploadFile() {
          >> YAHOO.widget.dialogUploadFile.show();
          >> }
          >> </script>
          >> </head>
          >> <body>
          >>
          >> <div id="functionButtons">
          >> <button onclick="uploadFile()">Upload file</button>
          >> </div>
          >>
          >> <div id="dialogUpload">
          >> <div class="hd">Upload file</div>
          >> <div class="bd">
          >> <form enctype="multipart/form-data" method="post"
          >> action="uploadTest.php" >
          >> <input type='file' name='fileName' ><br /><br />
          >> <input type='submit' value="Upload now">
          >> </form>
          >> </div>
          >> </div>
          >>
          >> </body>
          >> </html>
          >>
          >>
        Your message has been successfully submitted and would be delivered to recipients shortly.