I am looking for the code to upload an image - or other nonxml document (pdf, doc) - into Tamino from a web form using an input type=“file”. I created an images schema in Tamino and can successfully load nonXML via the Interactive Editor. I am using Microsoft.xmlhttp in the web form. The goal will be to allow users to upload and mark-up their own nonxml documents.
thanks in advance.
This really belongs to the Jscript API discussion group.
First the Bad News and then the Good News
Bad news
----------
The problem is that undernormal circumstances the browser sandbox prevents Script in a web page from accessing data in the clients file system.
If you think about it there are very good reasons for this. So you can’t use XMLHTTP.
(you can get around this by installing Active X components in your Browser - but that is another story.)
Now the Good news
-------------------
There is another technique that works very nicely.
Here is the form.
Select File
and here is a script function that is called when the save button is pressed.
function save()
{
var saveURL = “http://myhost/tamino/mycollection/mydoctype/mydocname” ; //obviously this wouldn’t normally be a constant
var thisForm=document.all.item(“saveXML”);
thisForm.setAttribute(“action”,saveURL);
alert(saveURL); //to see what you did
thisForm.submit(); //this should cause the file to be loaded
}
When the button is pressed you get a Tamino response in a window called “loadout”
The save URL can include a docname as shown above.
or it could be anonymous.
in this case you would use
http://myhost/tamino/mycollection/mydoctype
instead.
I hope this is some use.