Rank: Newbie
Groups: Member
Joined: 7/1/2008(UTC) Posts: 8
|
I've set a Javascript error handler as per this page: http://www.aurigma.com/d...iu7/E_Uploader_Error.htmHow can I actually pass an error message back to the client in from upload.php? I've managed to set 500 headers so that the client knows it has failed, but how can I also send a text error message? In firefox I can send some text with the header response code, but it doesn't work for IE. My testing code in upload.php is: header('HTTP/1.1 501 My error'); header('Status: 501 My error'); exit; My altered Javascript is: <script type="text/javascript"> function Uploader1_Error(errorCode, httpResponseCode, errorPage, additionalInfo){ alert(errorCode); alert(httpResponseCode); alert(errorPage); alert(additionalInfo); document.getElementById('au_errors').innerHTML = errorCode + ' ' + httpResponseCode + ' ' + errorPage + ' ' + additionalInfo; } </script>
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 7/13/2011(UTC) Posts: 286
Thanks: 6 times Was thanked: 31 time(s) in 31 post(s)
|
Hello Jon,
Unfortunately there is a bug in ActiveX version of Image Uploader. It will be fixed in one of our upcoming releases.
Could you please tell whether you need to get custom error message only for debug purposes? In this case we could find some workaround for you.
Sorry for the inconvenience and thank you for your assistance. |
Best regards, Pauline Shirykalova Aurigma Technical Support
|
|
|
|
Rank: Newbie
Groups: Member
Joined: 7/1/2008(UTC) Posts: 8
|
Hi Pauline,
I'd like to give a readable error message to my user about what went wrong.
Examples:
Session Expired Album didn't exist Maximum number of photos uploaded Couldn't contact upload server
etc etc
All these error cases are dealt with in my serverside logic... I just need the user to see them.
Thanks, Jon
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 7/13/2011(UTC) Posts: 286
Thanks: 6 times Was thanked: 31 time(s) in 31 post(s)
|
Hello Jon, Here is a workaround for you. In your Error event please check the value of the httpResponseCode and alert your custom error message depending on the httpResponseCode value. You can use something like this: Code:function Uploader1_Error(errorCode, httpResponseCode, errorPage, additionalInfo){
switch (httpResponseCode)
{
case 501:{
alert('Error 501. Your custom message');
break;
}
case 502:{
alert('Error 502. Your Custom message');
break;
}
// other server side errors
}
}
Another variant is to add your message to server response: upload.php: Code:<php
....
header ("HTTP/1.1 501 Not Implemented");
print ("HTTP/1.1 501 Your custom warning message");
...
?>
index.php: Code:function Uploader1_Error(errorCode, httpResponseCode, errorPage, additionalInfo)
{
alert(httpResponseCode + " " + errorPage);
}
Edited by user Monday, August 8, 2011 3:03:15 AM(UTC)
| Reason: Not specified |
Best regards, Pauline Shirykalova Aurigma Technical Support
|
|
|
|
Rank: Newbie
Groups: Member
Joined: 7/1/2008(UTC) Posts: 8
|
Thanks Pauline,
I didn't realise that option #2 was possible. This has worked-around my problem.
Cheers, Jon
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 7/13/2011(UTC) Posts: 286
Thanks: 6 times Was thanked: 31 time(s) in 31 post(s)
|
Hello Jon,
Good to know this works for you. If you have any additional questions please feel free to ask. |
Best regards, Pauline Shirykalova Aurigma Technical Support
|
|
|
|
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.