Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <% form_for :picture, :url => {:action => :upload}, :html => {:multipart => true} do |f| %>
- <div>
- Titolo<br />
- <%= f.text_field :title, :class => "textinput" %>
- </div>
- <div>
- Descrizione<br />
- <%= f.text_area :description, :class => "textinput",:style => "width: 247px; height: 100px;" %>
- </div>
- <div>
- Album<br />
- <%= f.select(:album_id,
- current_user.photo_albums.collect {|p| [ p.title, p.id ]},
- :style =>"width: 200px;", :class => "textinput") %>
- </div>
- <%= f.file_field :uploaded_data, :class => "textinput" %>
- <%= submit_tag 'Upload >>' %>
- <% end %>
- def upload
- return if !request.post?
- if params[:picture] && params[:picture][:uploaded_data].respond_to?(:size) && params[:picture][:uploaded_data].size > 0
- current_user.photos << Picture.create(params[:picture])
- redirect_to :action => :show
- else
- flash[:error] = 'Problems uploading your avatar.'
- redirect_to :action => :upload
- end
- end
Add Comment
Please, Sign In to add comment