0 votes
621 views
in Coach Views by (290 points)

2 Answers

0 votes
by (11.2k points)
edited by
 
Best answer

An alternate way is to create a custom multiple file upload control and use a ajax service to receive the content and then write it to the file system, this will be much faster than uploading to local document store and then retrieving it again for writing.

Attached is a basic sample of such an upload Coach View along with the ajax service which writes to file system. It will try to write to the /tmp folder assuming its unix please make changes to the folder location in the ajax or create a writeable /tmp folder. It will display the currently uploaded files only but you can expand it to allow multiple time uploads building the list with each upload. Also the base64 string available in the ajax can alternatively be written to a database also. 

This control is now part of "Dosvak UI Toolkit" available at our Gitlab Location

+1 vote
by
edited by anonymous

You can mount a windows share on unix or on windows server you can use a unc path to write file

The process is as follows use the document upload control from content management toolkit and let the user upload all files, the document upload control binds to a ECMDocumentInfo list type, which contains the document urls for all the documents, you can retrieve the docID from the URL, then using Content Integration palette item and the docID get the contents of the document, the contents can be written to the file system using the following live connect code.  

Example code is attached here https://bpm.tips/?qa=blob&qa_blobid=4491901628652884218

var byteValue = Packages.java.lang.String(tw.local.contentStream.content).getBytes();

var content64 = Packages.org.apache.commons.codec.binary.Base64.decodeBase64(byteValue); 

 var fileName="/tmp/" + tw.local.counter +  "testfile.png"; // use the right file type of you can get the name from the properties also
            var file = new Packages.java.io.File(fileName);
           
             // if file doesnt exists, then create it
            if (!file.exists()) {
                file.createNewFile();
            }
            var fop = new Packages.java.io.FileOutputStream(file);
            fop.write(content64); 

Related questions

0 votes
0 answers 61 views
0 votes
0 answers 49 views
0 votes
0 answers 16 views
0 votes
1 answer 46 views
0 votes
1 answer 138 views
0 votes
0 answers 273 views
0 votes
1 answer 70 views
+1 vote
0 answers 84 views
0 votes
1 answer 227 views
0 votes
1 answer 106 views
0 votes
1 answer 235 views
asked May 26, 2018 in Coach Views by BHAGYARAVI (320 points)
0 votes
3 answers 415 views
0 votes
0 answers 33 views

515 questions

423 answers

81 comments

1.6k users

Welcome to BPM Tips Q&A, Community wiki/forum where you can ask questions and receive answers from other IBM BPM experts and members of the community. Users with 2000 points will automatically be promoted to expert level.
...