Guest User

Untitled

a guest
May 16th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. #View
  2. <form action="/swfupload" method="post" id="photoupload2" enctype="multipart/form-data">
  3. <div class="halfsize">
  4. <fieldset>
  5. <legend>Uploader</legend>
  6.  
  7. <div class="label emph">
  8. <label for="photoupload2-filedata-1">
  9. Upload Files:
  10. <span>After selecting the photos start the upload.</span>
  11. </label>
  12. <input type="file" name="Filedata" id="photoupload2-filedata-1" />
  13. </div>
  14.  
  15. </fieldset>
  16. </div>
  17.  
  18.  
  19. #Controller
  20. def swfupload
  21. # swfupload action set in routes.rb
  22.  
  23. # The content_type is set as application/octet by the flash program
  24. # Use mimetype-fu to determine the mimetype before passing it
  25. # to the attachment_fu enabled model
  26.  
  27. @basefile = Basefile.from(params[:Filedata])
  28. #Basefile.from(params[:butt])
  29.  
  30. # params[:Filedata].content_type = File.mime_type?(params[:Filedata].original_filename)
  31. # @basefile = Basefile.from(params[:butt] => params[:Filedata])
  32.  
  33. @basefile.folder_id = params[:folder_id]
  34. @basenumber = @basefile
  35. @basefile.save!
  36. redirect( "folders/"+"#{@basenumber}" )
  37. # redirect_to :controller => 'folders', :id => params[:id]
  38.  
  39. # This returns the thumbnail url for handlers.js to use to display the thumbnail
  40. # rescue
  41. # render :text => "Error"
  42. end
Add Comment
Please, Sign In to add comment