• upload multiple files

  • Do you want to create a native client or integrate with third party applications: webservices are the solution.
Do you want to create a native client or integrate with third party applications: webservices are the solution.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #14234  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
 #14266  by jllort
 
You're uploading files across webservices, could we take a look this piece of code to understanding what is your code doing ?
 #14275  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 all
int 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!
 #14299  by pavila
 
You need to set the destination path in the kmDoc object:
Code: Select all
kmDoc.setPath("/okm:root/destination.pdf");
Also you can use the simplified version of document create. See createSimple for more info.
 #14321  by raygrrr
 
pavila wrote:You need to set the destination path in the kmDoc object:
Code: Select all
kmDoc.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!!!
 #14347  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.
 #14393  by raygrrr
 
thanks, below is the log generated when I was uploading 5 files:
Code: Select all
11: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!!!
 #14407  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?
 #14410  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... :oops:
 #14457  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!!! :D
 #18461  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

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.