Hi Tod,
Thanks for reply. I downloaded the latest filetransfer library from svn as you mentioned and used it in my project. I changed DEFAULT_TEMP_LOCATION from "java.io.tmp" to "c:/temp". And also i changed DEFAULT_UPLOAD_SIZE_LIMIT from 20* 1024 * 1024 to 128 * 1024 * 1024. After that when i tested the component with a file of 30MB size, the progressbar goes quickly from 0% to 100% in single step and when i checked the directory i could see that the upload process still continues(i refresh the explorer and every time the file size grows up to 30MB) and finishes in 3-4 seconds. I mean the progressbar and upload process are not seem to be synchronized. And the file is now permanent in the directory.
When i tested the component with a file of 6MB size(10MB of file results as the same), the progressbar goes step by step like 9%->15%->30%...->100%. This is good but this time when the upload finished, the file is deleted somehow nearly in 3 seconds. Must i changed some part of the code for permanent storing for files with small sizes?
Thanks for the sample source code but when i use the jars from echopoint-3.0.0b2.zip it throws somehow this error:
16:41:54,561 ERROR [STDERR] java.lang.NullPointerException
16:41:54,561 ERROR [STDERR] at org.apache.log4j.CategoryKey.<init>(CategoryKey.java:31)
In this thread http://echo.nextapp.com/site/node/5957 we discuss this with rakesh but adding source codes and commenting the lines that includes log4j statements doesn't solve the issue.
Could you send me the echopoint jar that you use in your project.
Yes of course. The error is exactly log4j problem. When i comment the lines that includes log4j statements there is no error. But this time another problems occured which was written on the thread that i mentioned in my previous reply
I'don't know about the
I'don't know about the standard component, but the one from echopoint definitively supports it.
http://sptci.com/projects/echopoint/api/app/index.html
Look for the FileUploadSelector component.
André
The development version of
The development version of File Transfer currently provides a progress bar:
https://svn.nextapp.com/svn/echo3filetransfer/branches/exp/
These changes will soon be moved into the trunk, but a bit more refactoring (and possibly some API changes) will likely happen first (this week).
Hi Tod, Thanks for reply. I
Hi Tod,
Thanks for reply. I downloaded the latest filetransfer library from svn as you mentioned and used it in my project. I changed DEFAULT_TEMP_LOCATION from "java.io.tmp" to "c:/temp". And also i changed DEFAULT_UPLOAD_SIZE_LIMIT from 20* 1024 * 1024 to 128 * 1024 * 1024. After that when i tested the component with a file of 30MB size, the progressbar goes quickly from 0% to 100% in single step and when i checked the directory i could see that the upload process still continues(i refresh the explorer and every time the file size grows up to 30MB) and finishes in 3-4 seconds. I mean the progressbar and upload process are not seem to be synchronized. And the file is now permanent in the directory.
When i tested the component with a file of 6MB size(10MB of file results as the same), the progressbar goes step by step like 9%->15%->30%...->100%. This is good but this time when the upload finished, the file is deleted somehow nearly in 3 seconds. Must i changed some part of the code for permanent storing for files with small sizes?
Thanks
Ercan
Hi Ercan, I think you could
Hi Ercan,
I think you could use the FileUploadSelector in EchoPoint.
It will handles the events and the progressbar for you except that it shows filesize (XXXkb out of XXXkb done) instead of percentage.
If you need the sample codes, i can provide u with some coding that i'm using.
Thanks.
Regards,
Chee Han
Hi Chee Han, Thanks for
Hi Chee Han,
Thanks for quick reply. The sample codes would be very useful.
Thanks.
Ercan
In the javadoc there is
In the javadoc there is sample code included.
http://sptci.com/projects/echopoint/api/app/echopoint/tucana/FileUploadSelector.html
André
sample code final
sample code
upload event listener
package studentview; import nextapp.echo.app.Extent; import nextapp.echo.app.Insets; import nextapp.echo.app.event.ActionEvent; import nextapp.echo.app.event.ActionListener; import nextapp.echo.app.layout.RowLayoutData; import echopoint.tucana.FileUploadSelector; import echopoint.tucana.event.UploadCallback; import echopoint.tucana.event.UploadCancelEvent; import echopoint.tucana.event.UploadFailEvent; import echopoint.tucana.event.UploadFinishEvent; import echopoint.DirectHtml; public class FinishListener implements ActionListener { private static final long serialVersionUID = 1l; private GeneralUploadWindow guw; public FinishListener(GeneralUploadWindow newguw) { guw = newguw; } public FinishListener(){ guw = null; } public void actionPerformed(final ActionEvent event) { final FileUploadSelector upload = (FileUploadSelector) event .getSource(); final UploadCallback callback = upload.getUploadCallback(); if (callback != null) { final StringBuilder builder = new StringBuilder(128); for (int ii = 1; ii < upload.getParent().getComponentCount(); ii++) { upload.getParent().remove(ii); } if (callback.getEvent() instanceof UploadFinishEvent) { builder.append("Upload of file: <b>"); builder.append(callback.getEvent().getFileName()); builder.append("</b> succeeded."); } final boolean success = (callback.getEvent() instanceof UploadFinishEvent); if (callback.getEvent() instanceof UploadFailEvent) { builder.append("Upload "); if (callback.getEvent() != null) { builder.append(" of file: <b>"); builder.append(callback.getEvent().getFileName()); builder.append("</b>"); } builder.append(" failed"); } if (callback.getEvent() instanceof UploadCancelEvent) { builder.append("Upload "); if (callback.getEvent() != null) { builder.append(" of file: <b>"); builder.append(callback.getEvent().getFileName()); builder.append("</b>"); } builder.append(" cancelled."); if(guw != null){ guw.getCancelButton().setEnabled(true); } } DirectHtml dh = new DirectHtml(builder.toString()); RowLayoutData buttonLayoutData = new RowLayoutData(); buttonLayoutData.setInsets(new Insets(new Extent(3, Extent.MM), new Extent(2, Extent.MM), new Extent(0, Extent.PX), new Extent( 0, Extent.PX))); dh.setLayoutData(buttonLayoutData); upload.getParent().add(dh); if(guw != null){ guw.getCancelButton().setEnabled(false); } if (upload.getProgressBar() != null) { if (success) { String filename = callback.getEvent().getFileName(); if(guw != null){ guw.successfulUpload(filename); } } upload.getProgressBar().setText( (success) ? "Finished upload!" : "Cancelled upload!"); } } } }hope it helps
I've gone through a long process to learn how to use this component :)
Thanks for the sample source
Thanks for the sample source code but when i use the jars from echopoint-3.0.0b2.zip it throws somehow this error:
In this thread http://echo.nextapp.com/site/node/5957 we discuss this with rakesh but adding source codes and commenting the lines that includes log4j statements doesn't solve the issue.
Could you send me the echopoint jar that you use in your project.
Thanks.
Ercan
Have you included the
Have you included the commons fileupload jar(s) from the jakarta project ?
http://commons.apache.org/fileupload/
André
Yes of course. The error is
Yes of course. The error is exactly log4j problem. When i comment the lines that includes log4j statements there is no error. But this time another problems occured which was written on the thread that i mentioned in my previous reply
There are quite a few of
There are quite a few of library to import for echopoint.
Did you import junit-4.4.jar, xstream-1.3.jar and commons-io-1.3.2.jar?
i did import all the 3 above library before i can use Echopoint.
Regards,
Chee Han
I added all the libraries
I added all the libraries that this component needs. The problem is not based on the libraries.
Hi ercanclk, Then i'm
Hi ercanclk,
Then i'm afraid that i'm not able to assist you in this.
The code works perfectly on my side.
Thanks.
Regards,
Chee Han
Thanks for reply Chee Han.
Thanks for reply Chee Han. Are you using echopoint-3.0.0b2 library?
Thanks
Ercan
Hi Ercan, i'm using
Hi Ercan,
i'm using Echopoing-3.0.0a8 library.
Regards,
Chee Han
some bugs still in the new filetransfer lib
The new file transfer library is much better than the old one but it still has a few issues as mentioned here
http://bugs.nextapp.com/mantis/view.php?id=193&nbn=4#bugnotes
I'm using the code from SVN from 2009-06-09 - the uploadComplete handler is not called for the very first upload. Subsequent uploads work.