json - File upload using angular js in lotus notes html form -


i using lotus notes form .html files , sending values server json using angular js. want upload files now. how can send files server , extract using lotus script?

can please me someone?

like below post. done in asp.net . want same using lotus notes.

file uploading angular js asp .net

index.html

<span ng-if="quests.type == '17'"> <input type="file" file-upload multiple id='{{quests.id}}'/> </span>  <button type="button" ng-click="submitform();">submit</button> 

the above button trigger below code executed.

angular code post server

var email=document.getelementbyid("email").value; var message={"requesttype": "saveform","email": emailid,"username": username}; $http.post("http://test.com/ajaxprocess?openagent", message).success(success).error(failure); 

the above mentioned agent(lotusscript) parse above json , save document shown below.

ajaxprocess agent code

'getting document context set doccontext = sess.documentcontext if doccontext.hasitem("request_content") or doccontext.hasitem("request_content_000")     'using openntf lotus script classes parse document json object     set userdatainfo=getjsonobjectfromdocument(doccontext, "")     dim fieldsobj new jsonarray     'getting fields array sent json array     set fieldsobj=userdatainfo.getitemvalue("fields")     fieldtype=field.mgetitemvalue("type")(0)     dim doc notesdocument     dim fieldname string     forall field in fieldsobj.items         fieldname=field.mgetitemvalue("fieldname")(0)         call doc.replaceitemvalue(fieldname,field.mgetitemvalue("value")(0))     end forall     call doc.save(true,false) end if 

everything works fine expect file attachments. how can send files server json , save using lotus script or there other workaround there?

i found tip , made solution follows base64 string , convert attachment in lotusscript.

http://www-10.lotus.com/ldd/bpmpblog.nsf/dx/creating-a-mime-email-with-attachment?opendocument&comments

dim s new notessession  dim stream notesstream  dim body notesmimeentity  dim header notesmimeheader  dim stringinbase64 string  stringinbase64=getbase64() 'your base64 string  dim db notesdatabase  set db=s.currentdatabase  dim tempdoc notesdocument set tempdoc=db.createdocument() set stream = s.createstream call stream.writetext(stringinbase64) set body = tempdoc.createmimeentity set header = body.createheader("content-disposition") call header.setheaderval({attachment;filename="onchange.xlsx"}) ' file name , type should configurable call body.setcontentfromtext(stream, "", enc_base64) call stream.close tempdoc.form="attachment" call tempdoc.save(true,false) 

this works expected. time spent.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -