VL-Web file upload example
VL-Web file upload example
Is there some VL-Web file upload example? Both methods of file selection (via filepicker or via drag end drop) are required.
- Stewart Marshall
- Posts: 417
- Joined: Thu Nov 05, 2015 5:25 pm
Re: VL-Web file upload example
Hi Jiri
xDemoWebImageCapture shows how a file can be selected and then stored in a blob. This can then be sent to the server the same as any other field.
Drag and drop is not supported currently as a result of limited browser support.
A simple server routine to receive and manage a file might be coded as below
Regards
xDemoWebImageCapture shows how a file can be selected and then stored in a blob. This can then be sent to the server the same as any other field.
Drag and drop is not supported currently as a result of limited browser support.
A simple server routine to receive and manage a file might be coded as below
Code: Select all
Srvroutine Name(FileUpload)
Field_Map For(*Input) Field(#xDemoBlob) Parameter_Name(File)
Field_Map For(*Input) Field(#xDemoAlpha128) Parameter_Name(FileName)
Field_Map For(*Output) Field(#xDemoAlpha256) Parameter_Name(SavedTo)
* Move the temporary BLOB file to a permanent home
If (#Utilities.CopyFile( #xDemoBlob.FileName (*Part_Dir_Object + #xDemoAlpha128) ))
#xDemoAlpha256 := *Part_Dir_Object + #xDemoAlpha128
Endif
Endroutine
Re: VL-Web file upload example
I have related question - how to present the saved file back to client? In WAM, there was a special type of webroutine RESPONSE(*HTTPR), which was used for it.
In VL_WEB, I can have srvroutine like this:
Srvroutine Name(GET_DOC)
Field_Map For(*INPUT) Field(#DocID) Parameter_Name(ReqDocID)
Field_Map For(*OUTPUT) Field(#xDemoBlob) Parameter_Name(RetFile)
Fetch Fields(#xDemoBlob) From_File(DMSImages) With_Key(#DocID)
Endroutine
If the file is always image (as in example xEpmployeeImages) it can be presented as image or in list. But if the object is document (which can be .PDF, .DOC or image .jpg etc) how to present the response blob on client? As I mentioned, in WAMs response(*HTTPR) was used and fine - what similar technique can be used in VL-Web?
In VL_WEB, I can have srvroutine like this:
Srvroutine Name(GET_DOC)
Field_Map For(*INPUT) Field(#DocID) Parameter_Name(ReqDocID)
Field_Map For(*OUTPUT) Field(#xDemoBlob) Parameter_Name(RetFile)
Fetch Fields(#xDemoBlob) From_File(DMSImages) With_Key(#DocID)
Endroutine
If the file is always image (as in example xEpmployeeImages) it can be presented as image or in list. But if the object is document (which can be .PDF, .DOC or image .jpg etc) how to present the response blob on client? As I mentioned, in WAMs response(*HTTPR) was used and fine - what similar technique can be used in VL-Web?
- Stewart Marshall
- Posts: 417
- Joined: Thu Nov 05, 2015 5:25 pm
Re: VL-Web file upload example
Hi Jiri
Have a look at xDemoWebImageDownload.
This returns the Blob as an object rather than just a variable.
Regards
Have a look at xDemoWebImageDownload.
This returns the Blob as an object rather than just a variable.
Regards
Re: VL-Web file upload example
Thanks, the example is fine.
Is somewhere some more detail documentation about the RESPONSE usage? I have found reference to mentioned code ( http://docs.lansa.com/14/en/lansa017/co ... 1_0545.htm ) and response class http://docs.lansa.com/14/EN/LANSA016/PR ... sponse.htm, but I would welcome more examples using another response properties.
Is somewhere some more detail documentation about the RESPONSE usage? I have found reference to mentioned code ( http://docs.lansa.com/14/en/lansa017/co ... 1_0545.htm ) and response class http://docs.lansa.com/14/EN/LANSA016/PR ... sponse.htm, but I would welcome more examples using another response properties.
Re: VL-Web file upload example
The just released EPC141017 VLF-ONE version has 4 upload and download examples:
http://docs.lansa.com/14/en/lansa048/in ... 7_0115.htm
The shipped example code is easily reused outside of the VLF-ONE container.
http://docs.lansa.com/14/en/lansa048/in ... 7_0115.htm
The shipped example code is easily reused outside of the VLF-ONE container.