swfupload + скрепка + рельсы 3 - PullRequest
0 голосов
/ 23 марта 2011

Как я могу легко включить swfupload в свое приложение?

<%= form_for(@photo, :html => { :multipart => true }) do |f| %>
<%= f.text_field :title %>
<%= f.file_field :attachment %>
<%= f.submit "Upload" %>
<% end %>

Фотомодель

has_attached_file :attachment, 
                  :styles => { :small => "200x100", :big => "500x300>" }, 
                  :url  => "/images/attachments/:id/:style/:basename.:extension", 
              :path => "#{::Rails.root.to_s}/public/images/attachments/:id/:style/:basename.:extension"

контроллер фотографий

  def create
    @photo = current_user.photos.build(params[:photo])
      if @photo.save
        redirect_to(@photo)
      else
        render :action => "new"
      end
  end

1 Ответ

0 голосов
/ 23 марта 2011

Я сделал два приложения здесь: https://github.com/apneadiving/Pic-upload---Crop-in-Ajax

  • с загрузкой jQuery

  • с загрузкой swfupload

Они могут быть хорошими примерами

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...