diff --git a/cms/djangoapps/contentstore/views/assets.py b/cms/djangoapps/contentstore/views/assets.py index b5041d3e9f..872b71bcb7 100644 --- a/cms/djangoapps/contentstore/views/assets.py +++ b/cms/djangoapps/contentstore/views/assets.py @@ -103,6 +103,9 @@ def upload_asset(request, org, course, coursename): logging.error('Could not find course' + location) return HttpResponseBadRequest() + if 'file' not in request.FILES: + return HttpResponseBadRequest() + # compute a 'filename' which is similar to the location formatting, we're using the 'filename' # nomenclature since we're using a FileSystem paradigm here. We're just imposing # the Location string formatting expectations to keep things a bit more consistent diff --git a/cms/static/js/base.js b/cms/static/js/base.js index fe60d80239..2260579e49 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -411,8 +411,12 @@ function showFileSelectionMenu(e) { } function startUpload(e) { + file_input = $('.file-input').val().replace('C:\\fakepath\\', ''); + if (file_input === '') + return; + $('.upload-modal h1').html(gettext('Uploading…')); - $('.upload-modal .file-name').html($('.file-input').val().replace('C:\\fakepath\\', '')); + $('.upload-modal .file-name').html(file_input); $('.upload-modal .file-chooser').ajaxSubmit({ beforeSend: resetUploadBar, uploadProgress: showUploadFeedback,