uploads: allow uploading multiple files from your computer at once.
Allow uploading multiple files from your computer at once. The maximum limit is 100 files at once. There is still a 50MB size limit that applies to the whole upload. This limit is at the Nginx level. The upload widget no longer shows a thumbnail preview of the uploaded file. This is because there isn't room for it in a multi-file upload, and because the next page will show a preview anyway after the files are uploaded. Direct file uploads are processed synchronously, so they may be slow. API change: the `POST /uploads` endpoint now expects the param to be `upload[files][]`, not `upload[file]`.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
# A component for uploading files to Danbooru. Used on the /uploads/new page.
|
||||
class FileUploadComponent < ApplicationComponent
|
||||
attr_reader :url, :referer_url, :drop_target, :max_file_size
|
||||
attr_reader :url, :referer_url, :drop_target, :max_file_size, :max_files_per_upload
|
||||
|
||||
# @param url [String] Optional. The URL to upload. If present, the URL field
|
||||
# will be prefilled in the widget and the upload will be immediately triggered.
|
||||
@@ -11,11 +11,13 @@ class FileUploadComponent < ApplicationComponent
|
||||
# events. If "body", then files can be dropped anywhere on the page, not
|
||||
# just on the upload widget itself.
|
||||
# @param max_file_size [Integer] The max size in bytes of an upload.
|
||||
def initialize(url: nil, referer_url: nil, drop_target: nil, max_file_size: Danbooru.config.max_file_size)
|
||||
# @param max_files_per_upload [Integer] The maximum number of files per upload.
|
||||
def initialize(url: nil, referer_url: nil, drop_target: nil, max_file_size: Danbooru.config.max_file_size, max_files_per_upload: Upload::MAX_FILES_PER_UPLOAD)
|
||||
@url = url
|
||||
@referer_url = referer_url
|
||||
@drop_target = drop_target
|
||||
@max_file_size = max_file_size
|
||||
@max_files_per_upload = max_files_per_upload
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user