Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
ravikiran  
#1 Posted : Monday, October 24, 2005 12:06:16 AM(UTC)
ravikiran

Rank: Member

Groups: Member
Joined: 10/24/2005(UTC)
Posts: 9

Hi,

I am new to ImageUploader. so, please bare with me if i am wrong..

I am using ImageUploader ActiveX control and in a JSP page, which posts the repsonse to a servlet. In the servlet, i upload all the images selected by the client to a location. When i get an error message in the servlet, how do i pass it to the client? Currently, it always displays that the images were uploaded successfully (Message given by me in the Property: MessageUploadCompleteText) even when there is an error on the server side.

Please help me out as this is urgent!!

Regards,

Ravi.

Fedor  
#2 Posted : Saturday, October 29, 2005 5:12:21 PM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Hello Ravi,

I am sorry for delay.

Quote:
ravikiran (10/24/2005)

Hi,

I am new to ImageUploader. so, please bare with me if i am wrong..

I am using ImageUploader ActiveX control and in a JSP page, which posts the repsonse to a servlet. In the servlet, i upload all the images selected by the client to a location. When i get an error message in the servlet, how do i pass it to the client? Currently, it always displays that the images were uploaded successfully (Message given by me in the Property: MessageUploadCompleteText) even when there is an error on the server side.[/url]

If you have error on server side, then you can send to client 500 response code. In this case Image Uploader will display message "Some server error occured".

On other side if you have custom error on server (for example user quota on server is over), then you can send to user custom error message with normal 200 response code. In order to achieve it set ShowUploadCompleteMessage property to False value and handle upload completion via JavaScript.

Code:
<script type="text/javascript" src='../iuembed.js'></script>
<script type="text/javascript">
function ImageUploader_Progress(Status, Progress, ValueMax, Value, StatusText)
{
    if (Status=="COMPLETE"){
        //We redirect to PictureGalery.asp page when upload process is completed
        window.location.replace('PictureGallery.aspx');
    }
}

var iu = new ImageUploaderWriter("ImageUploader", 710, 500);

iu.addEventListener("Progress", "ImageUploader_Progress");

iu.writeHtml();
</script>

StatusText parameter will contain the response body from server. So way if you send to response in servlet some text, you can get it on client using this parameter. For example you can write the text of error message in servlet if error has occured :

Code:
out.println("Your disk quota on server is over!");

And then check for it in client-side script:

Code:
<script type="text/javascript" src='../iuembed.js'></script>
<script type="text/javascript">
function ImageUploader_Progress(Status, Progress, ValueMax, Value, StatusText)
{
    if (Status=="COMPLETE"){
        //No error occured
        if (StatusText==""){
            //We redirect to PictureGalery.asp page when upload process is completed
            window.location.replace('PictureGallery.aspx');
        }
        //Error occured
        else{
            alert(StatusText);
        }
    }
}

Edited by user Wednesday, October 29, 2008 2:09:40 PM(UTC)  | Reason: Not specified

Best regards,

Fedor Skvortsov

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.