Handle empty uploads
This commit is contained in:
parent
91a801c445
commit
b67ac9d36a
1 changed files with 7 additions and 0 deletions
|
|
@ -39,6 +39,13 @@ class PackagesController < ApplicationController
|
|||
@valid_images = []
|
||||
@invalid_images = []
|
||||
|
||||
# If Javascript is disabled a user may submit an empty selection of images.
|
||||
if params[:file] == nil
|
||||
flash[:error] = "You have not selected any images."
|
||||
redirect_to upload_path
|
||||
return
|
||||
end
|
||||
|
||||
params[:file].each do |img|
|
||||
new_screenshot = @package.screenshots.new(image: img)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue