I'm using an AJAX uploader in Rails 3, along with paper_clip and have files uploading here:
  def upload
    @photo = Photo.create({ :photo =&开发者_JAVA技巧gt; params[:file], :title =>  params[:filename]  })
    respond_to do |format|
      format.json
    end
  end
I want to set the photo's title as the photo's filename, but don't know how to, even though params[:file] does have the file and is being uploaded to S3.
Any ideas?
Thanks
params[:file].original_filename has the filename you are looking for.
params[:name] should have the name of the attachment and params[:mime_type] which shows the mime type will be available in the params which u can use. Just to verify, you can use raise params.inspect like how Jamie Wong suggested.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论