support arbitrary attachments

This commit is contained in:
Régis Hanol
2013-07-10 22:54:05 +02:00
parent e8c1a81e87
commit 27ab5f471c
5 changed files with 61 additions and 38 deletions

View File

@ -4,8 +4,7 @@ class UploadsController < ApplicationController
def create
file = params[:file] || params[:files].first
# only supports images for now
return render status: 415, json: failed_json unless file.content_type =~ /^image\/.+/
return render status: 415, json: failed_json unless SiteSetting.authorized_file?(file)
upload = Upload.create_for(current_user.id, file)