Page 1 of 1
upload multiple files
PostPosted:Thu Mar 01, 2012 9:40 am
by raygrrr
Hi chaps,
I am using struts 1 for our web application, there is this page user can download/upload files, however, when user doing multiple files upload, not every files has been sucessfully uploaded, it seems like I can only upload 3 files at a time even though the code called the webservice for file upload 5 times, I use "Thread.sleep(10000)" in the loop but didn't help...
Is there anything I need to pay attendtion if I need to upload many files (in a loop)? many thanks!
Regards,
Ray
Re: upload multiple files
PostPosted:Sun Mar 04, 2012 11:24 am
by jllort
You're uploading files across webservices, could we take a look this piece of code to understanding what is your code doing ?
Re: upload multiple files
PostPosted:Mon Mar 05, 2012 2:40 am
by raygrrr
Many thanks for your reply, so basically speaking, I am using struts 1, I put my code in below (try to make it look as simple as possible):
JSP:
Code: Select all<html:form enctype="multipart/form-data" action="/multipleDocumentUpload.do" method="post" >
<input type="file" name="inputFile[0]">
<input type="file" name="inputFile[1]">
<input type="file" name="inputFile[2]">
<input type="file" name="inputFile[3]">
<input type="file" name="inputFile[4]">
<html:submit onclick="javascript:multipleDocumentUploadForm.submit();">Upload</html:submit>
</html:form>
Java Action Class:
Code: Select allint length = multipleDocumentUploadForm.getInputFileSize(); //size will be 5 in this case
for (int i=0;i<length;i++) {
try {
OKMDocument oKMDocument = new OKMDocumentProxy();
com.openkm.ws.endpoint.Document kmDoc = new com.openkm.ws.endpoint.Document();
oKMDocument.create(token, kmDoc, multipleDocumentUploadForm.getInputFile(i).getFileData());
} catch (java.io.IOException ex) {
log.error(ex.getMessage());
}
}
Basically speaking, my issue is that it won't upload all the files I selected, say if I selected 5 files like above, it maybe only upoloaded 3 files for me...I hope my sample code make sense, thanks sooooooooooooooooooooooooo much!
Re: upload multiple files
PostPosted:Tue Mar 06, 2012 8:03 am
by pavila
You need to set the destination path in the kmDoc object:
Code: Select allkmDoc.setPath("/okm:root/destination.pdf");
Also you can use the simplified version of document create. See
createSimple for more info.
Re: upload multiple files
PostPosted:Wed Mar 07, 2012 3:47 am
by raygrrr
pavila wrote:You need to set the destination path in the kmDoc object:
Code: Select allkmDoc.setPath("/okm:root/destination.pdf");
Also you can use the simplified version of document create. See createSimple for more info.
Thanks for your reply, I did set the path, sorry I forgot to put it in my sample code, my code is working if I didn't upload too many files at a time (< 3 files), so createSimple method will overcome this limitation?
Many thanks again!!!
Re: upload multiple files
PostPosted:Wed Mar 07, 2012 6:22 pm
by pavila
There is no concurrent upload limitation. Please, post the related part of the server log (no the whole one) to see what is failing.
Re: upload multiple files
PostPosted:Fri Mar 09, 2012 3:03 am
by raygrrr
thanks, below is the log generated when I was uploading 5 files:
Code: Select all11:00:40,980 INFO [MultiIndex] Unable to delete obsolete index: _f
11:00:40,988 INFO [MultiIndex] Unable to delete obsolete index: _e
11:00:41,012 INFO [MultiIndex] Unable to delete obsolete index: _1
11:00:41,012 INFO [MultiIndex] Unable to delete obsolete index: _2
11:00:49,031 INFO [MultiIndex] updating index with 1 nodes from indexing queue.
11:00:54,181 INFO [MultiIndex] Unable to delete obsolete index: _1
11:00:54,182 INFO [MultiIndex] Unable to delete obsolete index: _2
11:00:54,222 INFO [MultiIndex] Unable to delete obsolete index: _f
11:00:54,230 INFO [MultiIndex] Unable to delete obsolete index: _e
11:00:56,042 INFO [MultiIndex] updating index with 1 nodes from indexing queue.
11:00:57,806 WARN [PdfTextExtractor] PDF does not contains text layer
11:00:57,832 WARN [CuneiformTextExtractor] Undefined OCR application
11:00:57,845 WARN [CuneiformTextExtractor] Undefined OCR application
11:00:57,848 WARN [RegisteredExtractors] There was a problem extracting text from '/okm:root/SPRS/0545/sts/20111215-619/null-120309030054000-SCNG.pdf'
11:00:58,163 WARN [PdfTextExtractor] PDF does not contains text layer
11:00:58,174 WARN [CuneiformTextExtractor] Undefined OCR application
11:00:58,191 WARN [CuneiformTextExtractor] Undefined OCR application
11:00:58,295 WARN [PdfTextExtractor] PDF does not contains text layer
11:00:58,307 WARN [CuneiformTextExtractor] Undefined OCR application
11:00:58,320 WARN [CuneiformTextExtractor] Undefined OCR application
11:01:02,070 INFO [MultiIndex] Unable to delete obsolete index: _1
11:01:02,071 INFO [MultiIndex] Unable to delete obsolete index: _2
11:01:02,090 INFO [MultiIndex] Unable to delete obsolete index: _f
11:01:02,090 INFO [MultiIndex] Unable to delete obsolete index: _e
I thought the OCR issue and extracting text thing are not really related to do with uploading?
Many many thanks again!!!
Re: upload multiple files
PostPosted:Fri Mar 09, 2012 12:10 pm
by pavila
There is nothing in the log that shows an error on the file upload. The warning are not important. OpenKM is installed in Windows or Linux server?
Re: upload multiple files
PostPosted:Sat Mar 10, 2012 1:06 am
by raygrrr
pavila wrote:There is nothing in the log that shows an error on the file upload. The warning are not important. OpenKM is installed in Windows or Linux server?
Thanks again, it's in Linux server, I too think that log is not detailed enough, hmm...

Re: upload multiple files
PostPosted:Sat Mar 10, 2012 4:02 pm
by pavila
Follow the steps at
http://wiki.openkm.com/index.php/Debug_log_info to get a more detailed log.
Re: upload multiple files
PostPosted:Tue Mar 13, 2012 1:36 am
by raygrrr
Thanks very much pavila! After checking the logs I found out it was my code... the webservice is working perfectly!
I really appreciated your help here!!!

Re: upload multiple files
PostPosted:Thu Sep 13, 2012 6:24 am
by nitishtrifid
Thanks for sharing the information. your article helps many seo begginer.
Re: upload multiple files
PostPosted:Sun Sep 16, 2012 5:58 am
by cjain78
Hi,
Can some one share one sample application which takes a document as input and upload to OpenKM? It will really help me alot for my application and rest of understanding.
Regards
Chirag
Re: upload multiple files
PostPosted:Wed Jul 08, 2015 11:24 am
by MacFerden
UP!!! It would be great to see examples.
Re: upload multiple files
PostPosted:Fri Jul 10, 2015 2:24 pm
by jllort
How do you want to upload, with thirdparty application using one of the sdk ?
http://wiki.openkm.com/index.php/SDK