From 662ab0a287412d80752e0c3c41ea3766345a5bee Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Tue, 22 Jun 2010 01:27:47 -0400 Subject: add avatar upload limits --- static/js/pichat.js | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'static/js/pichat.js') diff --git a/static/js/pichat.js b/static/js/pichat.js index 3981d7e..1f64c20 100644 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -705,7 +705,8 @@ function setupUploadAvatar(elementId) { }; var onComplete = function(file, resp) { $('#spinner').hide(); - var r = $.trim(resp); + var r = $.trim(resp); + if (r == 'INVALID_REQUEST') { location.reload(); } else if (r == 'NOT_LOGGED_IN') { @@ -714,13 +715,21 @@ function setupUploadAvatar(elementId) { alert("Sorry, dump.fm can't deal with your image. Pick another :("); return; } else if (r.match(/FILE_TOO_BIG/)) { - var maxSize = r.split(" ")[1] / 1024; - alert("Sorry. Your file is just too fucking big. " - + maxSize + "KB or less please."); - return; - } - var s = ''; + console.log('setting avatar img to ' + s); + $('#dashavatar').html(s).show(); }; new AjaxUpload(elementId, { action: '/upload/avatar', -- cgit v1.2.3-70-g09d2