I am using Dojo toolkit and am facing a problem when handleAs is type html, when it's type text it works fine. The problem is that data is HTMLDocument. Please advice me on what i need to do. Am using jsp, tomcat to get a test case. the following are my sample codes
<code>
<html>
<head>
<title>simple dojo.io.iframe background file upload with PHP</title>
<style type="text/css">
@import "dojo/resources/dojo.css" ;
</style>
<script type="text/javascript" language="javascript" djConfig="parseOnLoad: true, isDebug: true" src="dojo/dojo.js"></script>
<script type="text/javascript" language="javascript" src="dojo/parser.js"></script>
<script type="text/javascript" language="javascript">
dojo.require("dojo.io.iframe");
function sendForm(frm){
dojo.io.iframe.send({
url: frm.action,
method: frm.method,
multitype:true,
enctype: frm.enctype,
handleAs: "html",
form: dojo.byId('mainForm'),
load: function(data,ioArgs){
var obj = data.getElementById("testTable");
var responseData = data;
dojo.byId('uploadedFiles').innerHTML = "success but "+responseData;
},
error : function(data, ioArgs) {
dojo.byId('uploadedFiles').innerHTML = "Error but "+data;
}
});
}
</script>
<!--</head>
<body class="tundra">
-->I have commented here cz the forums request,,,,so just remove <!-- -->
<h1>Simple Dojo -> PHP File Upload Example</h1>
<form id="mainForm" enctype="multipart/form-data" name="fileTest" action="receive.jsp" method="post" onSubmit="javascript:sendForm(this);">
<!-- you can upload x-domain. un-comment this, and the above addOnLoad to try -->
<!-- to host: <input type="hidden" name="name" value="" > -->
<br>
<!-- no real reason to have a div around this part -->
<div id="uploadContainer">
<input type="hidden" name="MAX_FILE_SIZE" value="500000">
<!-- wrapping these in spans to be able to modify parts of this form
depending on what the io.iframe.submit() does -->
<span id="preamble">File to Upload:</span><br>
<span id="inputField">
<input type="file" id="fileInput" name="uploadTestFile">
</span>
<!-- it would be cool to be able to know the filesize to
update progressBar any ideas? -->
<span id="progressField" style="display:none;">
</span>
</div>
<br>
<input type="submit" value="send form">
</form>
<br><br>
<a href="receive.jsps">receive.jsp source</a>
<!-- just so you can see -->
<div id="uploadedFiles"><h3>Uploaded so far:</h3>
</div>
<!--
</body>
</html>
-->
</code>

needed some info on file on server side
Hi there,
Were you able to get this working? I see from your code sample that you have used jsp on server side. I have been trying to use jsp to achieve this, the file gets written well on the server side. I am having issues on passing the file name back to the client. I am using JSON object to achieve this, but I see I am not able to get any data on the client side.I get the following error "missing ) in parenthetical in dojo.js".
In case you have found the solution for the problem can you please share on how are you trying to pass the info back from the server(JSP) to client. This would help me debug my issue.
Thanks.