public class DocUploaderForm : contractX.Security.ACL.SecuredPage { protected System.Web.UI.HtmlControls.HtmlInputFile fileUpload; private string connstring = "http://160.98.21.49/tamino/contractXDev"; private string NON_XML_COL = "contractXCol/nonXML"; private void Page_Load(object sender, System.EventArgs e) { if(!Page.IsPostBack) else { //Upload file if (target.Equals("upload")) { String filename = fileUpload.Value; if(fileUpload.PostedFile.Equals(null) || fileUpload.PostedFile.ContentLength == 0) { return false; } FileInfo fi = new FileInfo(filename); String only_filename = fi.Name; String sMimeType = GetMimeType(filename); try { TaminoConnection connection = new TaminoConnection (connstring); // Change to use the same initialisation with userRights; connection.Open(TaminoConnectionMode.AutoCommit); // Tamino provides collection ino:etc to insert non-XML data TaminoCommand command = connection.CreateCommand(NON_XML_COL); HttpPostedFile myFile = fileUpload.PostedFile; TaminoDocument doc = new TaminoDocument(myFile.InputStream, sMimeType); doc.DocType = ConfigurationSettings.AppSettings["binaryDocDoctype"]; // ino:nonXML is the doctype for non-XML data TaminoResponse response = command.Insert(doc); if (response.ReturnValue == "0") { XmlDocument res = response.XmlDocument; } else { return false; } connection.Close(); myFile.InputStream.Close(); } catch(Exception e) { string alertWindow = ""; Response.Write(alertWindow); connection.Close(); myFile.InputStream.Close(); } } } }