HTML Upload Error (dojox.form.Uploader)

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

HTML Upload Error (dojox.form.Uploader)

klng@intersoln.com
This post has NOT been accepted by the mailing list yet.
This post was updated on .
Hi,

If I have a tabcontainer similar to the configuration below without an iframe and everything in one file, the dojox.form.Uploader works prefectly.

However, if the scenario is with an iframe and as per below. I'll get HTML Upload Error..
Been struggling the last 3 days and finally found that it seems to be the iframe that causes this problem. But i have no idea how to solve this. Can anyone help please? Thanks in advance.

Best Regards
===================================
I've two files (File A & File B)

"File A":
Contain a tabcontainer with 2 tabs, please see below for details.
- Tab 1 contains a iframe to load "File B".
- Tab 2 contains dojox.form.Uploader

** File A **
<div dojoType="dijit.layout.TabContainer" style="width: 100%; height: 100%;">
  <div dojoType="dijit.layout.ContentPane" title="Tab 1" selected="true">
    <iframe style="border:0; margin:0; height:100%; width: 100%" src="File B"></iframe>
  </div>
  <div dojoType="dijit.layout.ContentPane" title="Tab 2">
    <form method="post" enctype="multipart/form-data">
      <input type="hidden" id="attachdesc" name="attachdesc" value="" /> 
      <input style="width:1px;height:20px;margin:0;padding:0" onChange="uploadChange"
        onComplete="uploadComplete" multiple="false" type="file"
        url="upload.jsp"
        dojoType="dojox.form.Uploader" label="Browse" id="butAttach" />
    </form>
    <div dojoType="dijit.form.Button" label="Upload" showLabel=true
      onClick="dijit.byId('butAttach').upload()"></div>
  </div>
</div>
**

"File B":
Contain a programmatically created dialog with dojox.form.Uploader that is involved using a button

** File B **
  new dijit.Dialog(
  {
    id:"dialogupload",
    style: "width:600px; height:100px",
    content: "<div id='dattach'></div>"
    });
    var frm = document.createElement("form");
    frm.enctype="multipart/form-data";
    frm.encoding="multipart/form-data";
    frm.method="post";

    var ip = document.createElement("input");
    ip.type = "hidden";
    ip.id = "_attachdesc";
    ip.name = "_attachdesc";
    frm.appendChild(ip);

    var tbl = document.createElement("table");
    var tbody = document.createElement("tbody");
    var tr = document.createElement("tr");

    var td = document.createElement("td");
    td.appendChild((new dojox.form.Uploader({
      label:"Browse",
      multiple:false,
      uploadOnSelect: false,
      url: "upload.jsp",
      form: frm,
      id: "_uploader"
    })).domNode);
    tr.appendChild(td);

    td = document.createElement("td");
    td.appendChild((new dijit.form.Button({
    id: "_upload",
    label : "Upload",
    onClick : function()
    {
      dijit.byId("_uploader").upload();
    }
  })).domNode);
  tr.appendChild(td);

  tbody.appendChild(tr);
  tbl.appendChild(tbody);
  frm.appendChild(tbl);
  dojo.byId("dattach").appendChild(frm);
**
Reply | Threaded
Open this post in threaded view
|

Re: HTML Upload Error (dojox.form.Uploader)

Aaasaasa
I have had the same problem with uploader - dojo 1.5.
Uploader have has a problem with tabContainer and Dialogs - you have both of them :)
My problem was like if I hide Dialog, I can't start it again - ID registered error
Tabs can't load Upload widget programmatically if any "enemy" dijit was there hehe
On the end I have made it but don't ask how :)
It means that the new uploader that you use - 1.6 1.7 with HTML5 plugins should work better...
Reply | Threaded
Open this post in threaded view
|

Re: HTML Upload Error (dojox.form.Uploader)

Aaasaasa
In reply to this post by klng@intersoln.com
you need in file B force="iframe" and dojo.require("dojox.form.uploader.plugins.IFrame");
http://dojotoolkit.org/reference-guide/dojox/form/Uploader.html#uploader-with-the-iframe-plugin
Reply | Threaded
Open this post in threaded view
|

Re: HTML Upload Error (dojox.form.Uploader)

klng@intersoln.com
This post has NOT been accepted by the mailing list yet.
Hi,

Thanks for the reply.

I am using the new dojox.form.Uploader of version 1.6 instead of dojox.form.FileUploader of version 1.5 which I've got working previously but in an unorthodox manner...

According to the documentation, dojox.form.Uploader will work with tabcontainer, etc.. so i eagerly "upgraded" from dojox.form.FileUploader only to find out it gave a new problem.. :(

I've also tried your suggestion of using force="iframe" and dojo.require("dojox.form.uploader.plugins.IFrame"), the problem persist.. the error is "HTML Upload Error:'getElementsByTagName(...).0.value' is null or not an object" even though my backend uploading function works perfectly with the correct returned string..

Any more clue or ideas on how I can solve this?

Thanks in advance.

Reply | Threaded
Open this post in threaded view
|

Re: HTML Upload Error (dojox.form.Uploader)

Aaasaasa
Only tagName is in that form input tag = name="attachdesc"
and as you can read 'The "name" Property' in
http://dojotoolkit.org/reference-guide/dojox/form/Uploader.html#uploader-with-the-iframe-plugin
it is a key property.

I would give name property to uploader
Reply | Threaded
Open this post in threaded view
|

Re: HTML Upload Error (dojox.form.Uploader)

klng@intersoln.com
This post has NOT been accepted by the mailing list yet.
Hi,

None.. adding name to uploader that doesn't work as well.. :(

Any more ideas?

Best Regards
Reply | Threaded
Open this post in threaded view
|

Re: HTML Upload Error (dojox.form.Uploader)

Aaasaasa
Hi,
can you send me slimmed code? I would try to solve that issue.

Best Regards
Reply | Threaded
Open this post in threaded view
|

Re: HTML Upload Error (dojox.form.Uploader)

klng@intersoln.com
This post has NOT been accepted by the mailing list yet.
Hi,

Thanks for your help in advance. As requested, please see attached.

Hope you can solve it..

Best Regards

A.txt

B.txt
Reply | Threaded
Open this post in threaded view
|

Re: HTML Upload Error (dojox.form.Uploader)

klng@intersoln.com
This post has NOT been accepted by the mailing list yet.
Hi there,

Any luck?

Best Regards