Opened 13 years ago

Closed 12 years ago

#2645 closed defect (wontfix)

Send file via dojo.io.bind

Reported by: Marcel Owned by: alex
Priority: high Milestone:
Component: IO Version: 0.4.2
Keywords: upload, dojo.io.bind, form Cc:
Blocked By: Blocking:

Description

Hi Dojo-Team. How can I display the result of the dojo.io.bind in the same div?

This is my function:

function uploadBind(formid, targetdiv) {
  dojo.io.bind({
    formNode: dojo.byId(formid),
    mimetype: "text/plain",
    content: {
	increment: ctr++,
	fileField: datei },
    handler: function(type, data, e) {
	dojo.byId(targetDiv).innerHTML = data; // Here I want to display the result..
    },
    error: function(type, error){ alert("Type: "+type+ "
Error: "+error); }
  });
}

This is my upload form:

<div id="upload">
  <form id="uploadform" action="./functions/uploadfile.php" method="POST" enctype="multipart/form-data">
  <input type="file" name="datei"  /><br />
  <input type="submit" name="submit" value="Hochladen" onclick="uploadBind('uploadform','upload')">
  </form> 
</div>

The upload works well, but it displays the result of the uploadfile.php in a new window, instead of displaying it in my <div id="upload"....

Change History (2)

comment:1 Changed 13 years ago by tw@…

there are just some errors in your code:

  • "submit" is a very bad choice for a fieldname
  • ctr seems not to be defined
  • dojo.byId(targetDiv).innerHTML should be dojo.byId(targetdiv).innerHTML
  • fileField: datei should be fileField: "datei"

Thomas

comment:2 Changed 12 years ago by James Burke

Resolution: wontfix
Status: newclosed

Looks like this was solved by Thomas' comment.

Note: See TracTickets for help on using tickets.