<input type="file">

I have an HTML form I have laid out in Designer. Each field has a corresponding Notes field, which when presented to a browser and submitted gets me a Notes document with all the field values just fine.

Now I want to be able to upload a file and have it come across as an attachment in a rich text field.

So I put in an , fire it up in a browser, browse for a file, submit it, and just get the file path.

So I add <enctype=“multipart/form-data”> to my HTML form, and voila I get the file contents!

Which is great for a text file, the contents show in the rich text field. But I want to attach an image. That gets me a rich text field with the gibberish you would expect if you opened a jpg with Notepad.

How do I take the contents of a file from a web submission, and turn it into a file attachment in Notes?

I fully realize that there is the built in File Upload Control, and that if I just did a Notes form instead of crafting my own HTML this would be easy. I’ve tried it and the File Upload Control does work fine (minor gripe having to use WebQuerySave to put it in a specific rich text field, but that would be no real problem). Pass-through Notes-content might do it :wink: But it seems like I’m 90% of the way there as is, the file is making it to Domino, I just need to handle it properly somehow.

I dug and dug:

http://www.codestore.net/store.nsf/UNID/BLOG-20051125?OpenDocument

-I could copy the “offset” you get with the built in File Upload Control, and use that in my , but that doesn’t seem solid, especially if it will be design refreshed to another database and then replicated out to another server…

http://www.ferdychristant.com/blog/archive/DOMV-64ZMD3

-The same thing basically, and earlier, but it lead to…

http://www.vincedimascio.com/vince/vpd.nsf/all/113A7631B85BA6578825723A007A27F2

-Fantastic working demo and download code. But this solves a different problem - multiple file uploads. And it does it with the built in File Upload Control. And it does it in a more complicated way than I need, with a separate document to hold the attachment - which gets you multiples, but just adds complexity for the single attachment I need. It is a very clever way to use the built in File Upload Control on a separate form with a hand crafted HTML main form and have it look like one page to the user, but with me already having the contents of the file reach the server I’m hoping there is some way I won’t have to go this route, creating a separate form and having some backend logic to merge the two documents together in Notes.

Does anyone have any idea how to take a rich text field containing the ASCII representation of a file and turn it into a rich text field with that file as an attachment? NotesMimeEntity doesn’t seem too promising, could this be the right time to get into DXL? Or is there any other simple way to have an HTML form with an produce a Notes document with an attachment in a rich text field? Any help greatly appreciated!

Subject:

HiYou can File UPload control or you can type html “”

then you can write code inside $$QuerySaveAgent to extract attachment and place into rich text field.

or

If you want to send file content to your lotus notes server without submitting webpage then you can use ajax (file upload using ajax).

Thanks

Subject: QuerySaveAgent

Thanks! Can you give me a general idea of what my QuerySaveAgent should do? I have a field with a collection of gibberish in it, how would I go about transforming that into a file attachment?