Hi,
I am using Backbase struts connector 4.2.0. I want to upload a file from one of the jsp page. But I am not able to do so, because I get following error in backbase debugger -
'Unsupported encoding: multipart/form-data'.
Follwoing the form fragment (from view tree) as shown in firebug.
<div xmlns="http://www.w3.org/1999/xhtml" xmlns:b="http://www.backbase.com/2006/btl" xmlns:bf="http
://www.backbase.com/2007/forms" xmlns:c="http://www.backbase.com/2006/command" xmlns:e="http://www.backbase
.com/2006/xel" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:bconc="http://www.backbase.com/2007/connectors
/client">
<form id="MyForm" method="post" action="/myAction.do" enctype="multipart/form-data">
<bconc:setDestination destination="id('container')" mode="replaceChildren" type="form"></bconc:setDestination>
<input type="text" name="pictureTitle" maxlength="200" size="21" value="" class="text-input" />
<textarea name="description" cols="50" rows="4" class="text-input"></textarea>
<input type="file" name="file" value="Browse..." class="text-input" />
<input type="hidden" name="pictureId" value="0" />
<input type="submit" value="Submit" />
</form>
</div>
://www.backbase.com/2007/forms" xmlns:c="http://www.backbase.com/2006/command" xmlns:e="http://www.backbase
.com/2006/xel" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:bconc="http://www.backbase.com/2007/connectors
/client">
<form id="MyForm" method="post" action="/myAction.do" enctype="multipart/form-data">
<bconc:setDestination destination="id('container')" mode="replaceChildren" type="form"></bconc:setDestination>
<input type="text" name="pictureTitle" maxlength="200" size="21" value="" class="text-input" />
<textarea name="description" cols="50" rows="4" class="text-input"></textarea>
<input type="file" name="file" value="Browse..." class="text-input" />
<input type="hidden" name="pictureId" value="0" />
<input type="submit" value="Submit" />
</form>
</div>
Please write if you have any solutions/ workarounds.
Regards,
Ajay

struts fileInput
23 June, 2008 - 12:55 — andysHi Akamble,
As far as I can understand, the backbase form does not support "multipart/form-data". The backbase form is only accept "application/x-www-form-urlencoded" as an enctype.
You can use backbase fileInput for uploading file. But then, it will only can be used for fileUpload. As I can see from your source code, you actually also want to submit other data (not only file upload).
You can use this code below to submit form with "multipart/form-data" which includes many types of form fields
loaded = function() {
var i = document.getElementById("upload");
if (i.contentDocument) {
var d = i.contentDocument;
} else if (i.contentWindow) {
var d = i.contentWindow.document;
} else {
var d = window.frames[id].document;
}
//var content = d.body.innerHTML + ''; //IE
var content = d.documentElement.textContent; //FF2
alert(content);
}
createIframe = function() {
var frame = document.getElementById("upload");
if(frame) return;
var stamp = new Date();
var container = document.createElement('div');
container.innerHTML = '<iframe style="display:block" type="text/html" src="about:blank" id="upload" name="upload" onload="loaded()"></iframe>';
document.body.appendChild(container);
}
upload = function(form) {
createIframe();
form.setAttribute("target","upload");
return true;
}
</script>
<form action="response.xml" method="post" onsubmit="upload(this)" enctype="multipart/form-data">
<div><label>Name:</label> <input type="text" name="name" /></div>
<div><label>File:</label> <input type="file" name="file" /></div>
<div><input type="submit" value="SUBMIT" /></div>
Hope this helps,
Andys