Xmlhttp and upload file

Hi All,

I am working on a requirement to create a document in Notes from an asp page. The asp page has a file upload control. I am calling the following agent to create a document in Notes. Everytime the user submits the asp page, a new document is created in Notes with all the required fields, but the uploaded file is missing. There is no file attachment found in the notes document.

Set doc=s.documentcontext

Set objHttp = CreateObject(“Msxml2.ServerXMLHTTP”)

url="https://www.abc.com/xxx.nsf/xmldoc?createdocument

req = “&NameTX=” &doc.UserName(0) & “&DepartmentTX=” & doc.Department(0) & “&filename=abc.txt” ’ hardcoded the file name for testing purposes

Call objHttp.open(“POST”, url, False, “userid”, “passwd”)

objHttp.setRequestHeader “Authorization”, "Basic " & Base64Encode(“userid:passwd”)

REM - Tried each of the following headers with NO success

’ objHttp.setRequestHeader “Content-Type”, “application/x-www-form-urlencoded; charset=UTF-8”

’ objHttp.setRequestHeader “Content-Type”, “multipart/form-data”

’ objHttp.setRequestHeader “ENCTYPE”, “multipart/form-data”

’ objHttp.setRequestHeader “postmode”, “multipart form”

objHttp.Send(req)

Set objHttp = Nothing

I am not sure whatelse to try to get the file attachment onto the Notes document. Please advise.

Thanks and Regards,

Saradhi.

Subject: xmlhttp and upload file

I’ve never tried that, but try searching the web. Some links that might be useful:http://builder.com.com/5100-31-5078105.html#CodeExample33

http://www.codeproject.com/aspnet/fileupload.asp

Be aware of that the name of the file upload control on your Domino/Notes form is changed every time you save the form. It usually is named something like “%%File.c1256b3800427975.c0e437c79e16c0acc1256b40007be865.$Body.0.16E”…

  • Johan

johan@kanngard.net

http://dev.kanngard.net