Created
February 19, 2011 23:55
-
-
Save happyrobots/835524 to your computer and use it in GitHub Desktop.
quick and dirty file upload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def upload(to_be_uploaded, upload_directory) | |
uuid = UUIDTools::UUID.random_create | |
uniq_name = "#{uuid}#{to_be_uploaded.original_filename}" | |
uploaded_file = File.join(upload_directory, uniq_name) | |
File.open(uploaded_file, "w") { |f| f.write(to_be_uploaded.read) } | |
uploaded_file | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment