diff --git a/css/style.css b/css/style.css index 6af2f4f..9acae34 100644 --- a/css/style.css +++ b/css/style.css @@ -148,12 +148,18 @@ h1{ left:0; height:100%; width:100%; - background: url('../img/done.png') no-repeat center center rgba(255,255,255,0.5); + display: none; } #dropbox .preview.done .uploaded{ display: block; + background: url('../img/success.png') no-repeat center center rgba(255,255,255,0.5); +} + +#dropbox .preview.error .uploaded{ + display: block; + background: url('../img/error.png') no-repeat center center rgba(255,255,255,0.5); } @@ -202,7 +208,6 @@ h1{ - #dropbox .linkHolder { position: absolute; left: 0; diff --git a/img/error.png b/img/error.png new file mode 100644 index 0000000..0323cd0 Binary files /dev/null and b/img/error.png differ diff --git a/img/success.png b/img/success.png new file mode 100644 index 0000000..3ddb764 Binary files /dev/null and b/img/success.png differ diff --git a/img/warning.png b/img/warning.png new file mode 100644 index 0000000..ddcb4dc Binary files /dev/null and b/img/warning.png differ diff --git a/js/upload.js b/js/upload.js index fa11a0a..1e50181 100644 --- a/js/upload.js +++ b/js/upload.js @@ -11,8 +11,16 @@ $(function(){ url: 'upload.php', uploadFinished:function(i,file,response){ - $.data(file).addClass('done'); - $.data(file).find('.linkBox').val(response.file); + if(response.type == 'error') { + alert('There was an error: ' + response.status); + $.data(file).addClass('error'); + $.data(file).find('.linkBox').remove(); + + return false; + } else { + $.data(file).addClass('done'); + $.data(file).find('.linkBox').val(response.file); + } // response is the JSON object that post_file.php returns },