#65: Don't start uploading if no file was selected

This commit is contained in:
Andy Heathershaw 2018-07-13 00:00:45 +01:00
parent 4b7b99431f
commit 6040c7d4ef
11 changed files with 35 additions and 1 deletions

View File

@ -296,6 +296,12 @@ class PhotoController extends Controller
// Load the linked album
$album = $this->loadAlbum($request->get('album_id'));
if (is_null($request->files->get('archive')))
{
$request->session()->flash('error', trans('admin.upload_bulk_no_file'));
return redirect(route('albums.show', ['id' => $album->id]));
}
$archiveFile = UploadedFile::createFromBase($request->files->get('archive'));
if ($archiveFile->getError() != UPLOAD_ERR_OK)
{

View File

@ -22923,6 +22923,13 @@ function UploadPhotosViewModel(album_id, queue_token, language, urls) {
// Get the selected files
var files = fileSelect[0].files;
if (files.length === 0)
{
alert(language.no_file_selected);
event.preventDefault();
return false;
}
// Reset statistics
this.currentStatus = '';
this.statusMessages = [];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -676,6 +676,13 @@ function UploadPhotosViewModel(album_id, queue_token, language, urls) {
// Get the selected files
var files = fileSelect[0].files;
if (files.length === 0)
{
alert(language.no_file_selected);
event.preventDefault();
return false;
}
// Reset statistics
this.currentStatus = '';
this.statusMessages = [];

View File

@ -258,6 +258,7 @@ return [
],
'title' => 'Gallery Admin',
'upload_bulk_heading' => 'Upload a zip archive',
'upload_bulk_no_file' => 'No archive was uploaded. Please select a file to upload.',
'upload_bulk_text' => 'You can use the form below to upload a zip archive that contains your photographs. Any valid image files in the zip archive will be imported. Common hidden folders used by operating systems will be ignored.',
'upload_bulk_text2' => 'Your web server is configured to allow files up to :max_upload_size to be uploaded.',
'upload_disabled_heading' => 'Uploading is not supported on this system.',
@ -268,6 +269,7 @@ return [
'upload_file_status_failed' => ':file_name failed to upload',
'upload_file_status_progress' => ':current of :total files completed',
'upload_file_status_success' => ':file_name uploaded successfully',
'upload_no_file' => 'Please select a photo file to upload.',
'upload_single_file_heading' => 'Upload photos individually',
'upload_single_file_text' => 'You can use the form below to upload individual files. To upload multiple files at once, hold down CTRL in the file browser.',
'upload_single_file_text2' => 'Your web server is configured to allow files up to :file_size. If you browser does not support HTML 5 (most modern browsers do), the combined size of all selected files must be less than :max_upload_size.',

View File

@ -91,6 +91,7 @@
language.select_all_choice_visible_action = '{!! addslashes(trans('admin.select_all_choice.visible_action')) !!}';
language.image_failed = '{!! addslashes(trans('admin.upload_file_status_failed')) !!}';
language.image_uploaded = '{!! addslashes(trans('admin.upload_file_status_success')) !!}';
language.no_file_selected = '{!! addslashes(trans('admin.upload_no_file')) !!}';
language.replace_image_message = '{!! addslashes(trans('admin.replace_image_message')) !!}';
language.replace_image_title = '{!! addslashes(trans('admin.replace_image_title')) !!}';
language.upload_status = '{!! addslashes(trans('admin.upload_file_status_progress')) !!}';