Hi
I am also looking for similar solution .
I need to upload multiple files from different sites
Say , site A ,has 3 files to upload
site B, has 4 files to upload .
i need to upload all or say tell location from where to upload files at once ,and finally press upload_Final button to start the upload .
After uploading i am parsing the stream that i get after upload and parsing them and then saving the parsed data to DB .
So i have to show progress monitor ,
Set immidiate wont help me .
Aslo i tried simply adding 10 upload buttons ,but while i am uploading one tar file,and then while frst is uploading ,m uploading second tar file ,then i see actually second tar file is not uploaded ,i ges some thread issue ,like only when one tar file upload done then only we need to start upload another tar file. but user has to wait for so long ,
Considering the above issue ,please let me know a solution ,as i will be uploading more than 10 GB of data at once ,
I have attached the screen shoot.
Below is the code i wrote for Receiver
public class TarFileReveiver implements Receiver {
/**
*
*/
private static final long serialVersionUID = 1L;
private String fileName;
private String mtype;
private String message;
/**
* return an OutputStream that simply counts line ends
*/
public OutputStream receiveUpload(String filename, String MIMEType) {
fileName = filename;
mtype = MIMEType;
// final FileOutputStream fos;
try {
return new OutputStream() {
long counter = 0;
// private TarArchiveEntry tarEntry;
final File file = new File(dirPath + "//"
+ fileName);
final FileOutputStream fos = new FileOutputStream(file);
final BufferedOutputStream bos = new BufferedOutputStream(
fos);
@Override
public void write(int b) throws IOException {
// insTime and site information from UI,ALSO IF POSSIBLE
// FILE NAME
counter++;
bos.write(b);
message = "Upload in progress..";
if (counter == contentLength) {
// System.out.println("data parsing started ...");
insTime = new Date(System.currentTimeMillis());
// System.out.println("getSelectedSite() "
// + getSelectedSite());
bos.flush();
bos.close();
message = " Upload done..";
result.setValue(tarFileReveiver.getMessage()
+ " (Importing...)");
state.setValue("Importing");
try {
// long y = System.currentTimeMillis();
InputStream is = new FileInputStream(file);
BufferedInputStream bis = new BufferedInputStream(
is);
//here i am sending the file for parsing
new LogParserService().parse(getSelectedSite(),
insTime, insfileNm, mtype, bis);
is.close(); message = " Import done..";
} catch (Exception e) {
getWindow().showNotification(e.getMessage(),
Notification.TYPE_ERROR_MESSAGE);
}
}
}
};
} catch (Exception ignore) {
ignore.printStackTrace();
return null;
}
}
public String getFileName() {
return fileName;
}
public String getMimeType() {
return mtype;
}
public String getMessage() {
return message;
}
}
Please help me on this ,
Also i am not able to use the add on provided ,as the APi usage is not that clear to me .
