+ if request.post?
+ tags = params[:tags] || ""
+ description = params[:description] || ""
+ pub = params[:public] || false
+
+ if params[:file].respond_to?(:read)
+ do_create(params[:file], tags, description, pub)
+
+ if @trace.id
+ render :text => @trace.id.to_s, :content_type => "text/plain"
+ elsif @trace.valid?
+ render :nothing => true, :status => :internal_server_error
+ else
+ render :nothing => true, :status => :bad_request
+ end
+ else
+ render :nothing => true, :status => :bad_request
+ end
+ else
+ render :nothing => true, :status => :method_not_allowed
+ end
+ end
+
+private
+
+ def do_create(file, tags, description, public)
+ # Sanitise the user's filename
+ name = file.original_filename.gsub(/[^a-zA-Z0-9.]/, '_')
+
+ # Get a temporary filename...