« Return to Thread: When activeReverseAjaxEnabled is true, File upload progress call not working
Hi, XMaNIaC and all,
I am now using the DWR FileTransfer with the help of IWebMvc example to
upload files, but unfortunately, the problem is the same, when I set
activeReverseAjaxEnabled to true in web.xml, the getStatus() call will be
called after all the bytes of the file are transferred, so the progress bar
will not show the progress of the uploading process and only show 100% in
the end of the transferring process, and the file is transferred
successfully since I can see the file in the folder I configured.
also one more problem is that the file transfer will failed when the file is
too big like over 16MB.
The strange thing is that If I switch activeReverseAjaxEnabled to false,
then the progress bar can show the progress smoothly. I check my log file,
it shows getStatus() calls between the calls to update(long newBytesRead,
long newContentLength, int items) of SessionProgressListener (I added
logging messages in this method), but with activeReverseAjaxEnabled set to
true, the log file shows the getStatus() call is always in the end of the
file transferring and the all update() calls are already done with all bytes
read.
I think in the IWebMvc example, the problem exists as well, it is just a
small image file uploading finishes very fast, it is not easy to notice, but
with a bigger file, it should show the progress on the progress bar.
Here is the code block:
uploadFile : function(record)
{
var uploadFinished = function(status){
var data = {
record: record,
response: status
}
if (status.success) {
this.fsa.postEvent('file-upload-success', data);
}
else {
this.fsa.postEvent('file-upload-error', data);
}
}
UploadMonitor.upload(this.inputUploadFile,
uploadFinished.createDelegate(this));
window.setTimeout("checkStatus()", 500);
}
function checkStatus() {
UploadMonitor.getStatus(updateProgress);
}
function updateProgress(data) {
if(data){
var percentage = (100 * data.bytesRead /
data.contentLength)|0;//can use parseInt(b/c)
var progressbar = Ext.getCmp('uploadprogressid');
progressbar.updateProgress(i,'Upload in progress: ' + percentage +
'%');
if (percentage < 100)
window.setTimeout(checkStatus, 100);
}else window.setTimeout(checkStatus, 100);
}
Thans very much and please help me solve the problem.
Dave
--
XMaNIaC wrote:
>
> Hi
>
> I would just use DWR FileTransfer and the progress bars it provides. Take
> a
> look at IWebMvc if you need some help.
>
> Regards,
>
> On Fri, Apr 18, 2008 at 9:37 PM, ddduuu <davidkdu@...> wrote:
>
>>
>> Hi, all,
>>
>> I have fileupload webapp with progress bar, I upload the file through
>> Ext
>> ajax call to a servlet, which transfers file with commons-fileupload
>> library, I have a dwr call to retrieve the upload status from server side
>> with a callback function to update the progress bar, it works great when
>> I
>> set activeReverseAjaxEnabled to false, but when I set it to true, the dwr
>> call will always come back to call the callback javascript function after
>> the servlet returns and upload is already done at that point, so the
>> progress bar does not show any progress at all.
>>
>> I am not sure why the ReverseAjax prevented my dwr function from being
>> called immediately. I checked my log file, the DWR call getUploadInfo()
>> is
>> called after the servlet is returned all the time. but if I set the
>> activeReverseAjaxEnabled to false, the DWR call getUploadInfo() will be
>> called before servlet doPost is done.
>>
>> Anybody has any clue about this issue?
>>
>> Thanks in advance.
>>
>> Dave
>> --
>> View this message in context:
>> http://www.nabble.com/When-activeReverseAjaxEnabled-is-true%2C-long-time-delay-for-java-call-tp16764605p16764605.html
>> Sent from the DWR - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
>
View this message in context: http://www.nabble.com/When-activeReverseAjaxEnabled-is-true%2C-long-time-delay-for-java-call-tp16764605p16834727.html
Sent from the DWR - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...
« Return to Thread: When activeReverseAjaxEnabled is true, File upload progress call not working
| Free Forum Powered by Nabble | Forum Help |