Home | Introduction | What's Included | Products | More Info | FAQ's

rails file upload/ выгрузка файла в ruby on rails 2+ - Rails - Snipplr Social Snippet Repository выход в лес

rails file upload/ выгрузка файла в ruby on rails 2+

 / Published in: Rails

Можно выкладывать даже файлы, содержащие кириллицу в названии. Они будет подвергнуты транслитерации, пробелы и другие небезопасные символы будут заменены на "_".

Expand | Embed | Plain Text
  1. source of file model *DataFile.rb* / Код класса DataFile.rb, который нужно создать в папке models
  4. require 'rutils'
  6. def self.save(upload)
  7. spl = upload['datafile'].original_filename.split('.')
  8. ext = spl[spl.length-1]
  10. name = File.basename(upload['datafile'].original_filename).gsub(/.#{ext}/,'').dirify<<'.'<<ext
  12. directory = "htdocs/images"
  13. # create the file path
  14. path = File.join(directory, name)
  15. # write the file
  16. File.open(path, "wb") { |f| f.write(upload['datafile'].read) }
  17. return name
  18. end
  22. -----------------------------
  23. uploading form view / форма выгрузки файла
  25. <form action="/anycontrooller/upload_action" enctype="multipart/form-data" method="post">
  26. <p><input id="upload_datafile" name="upload[datafile]" size="30" type="file" /></p>
  27. <input name="commit" type="submit" value="Upload" />
  28. </form>
  30. ---------------------------------
  31. Принимающий контроллер / receiving controller
  33. def upload
  34. timberland Kleidungi class="li1">
  35. begin
  36. post = DataFile.save(params[:upload])
  37. render :text =>'Файл был успешно выложен под именем <br />"<b>'<<post.to_s+'</b>"'
  38. rescue
  39. render :text =>'error'
  40. end
  42. end

Report this snippet   Tweet

You need to login to post a comment.

выход в лес

waar kan ik timberland laarzen kopen
zapatos de trabajo timberland
billige timberland støvler til mænd

Web Analysis for Old-games - old-games.ru

Old-Games.RU - сайт любителей старых игр. Сотни игр доступных для скачивания, с описанием и скриншотами.

2.92 Rating by CuteStat

old-games.ru is 1 decade 1 year old. It has a global traffic rank of #107,853 in the world. It is a domain having .ru extension. This site has a Google PageRank of 3/10. This website is estimated worth of $ 63,600.00 and have a daily income of around $ 106.00. As no active threats were reported recently by users, old-games.ru is SAFE to browse.

Display Domain Stats or Pagerank Widget for this domain on your website. Click Here
Google Pagerank
PR 3 out of 10
PageSpeed Score
Siteadvisor Rating
No Risk Issues

Traffic Report

Daily Unique Visitors: 8,475
Daily Pageviews: 42,375

Estimated Valuation

Income Per Day: $ 106.00
Estimated Worth: $ 63,600.00

Search Engine Indexes

Google Indexed Pages: 127,000
Yahoo Indexed Pages: 6,380
Bing Indexed Pages: Not Applicable

Search Engine Backlinks

Google Backlinks: Not Applicable
Bing Backlinks: Not Applicable
Alexa BackLinks: 405

Safety Information

Google Safe Browsing: No Risk Issues
Siteadvisor Rating: No Risk Issues
WOT Trustworthiness: Not Applicable
WOT Privacy: Not Applicable
WOT Child Safety: Not Applicable

Website Ranks & Scores

Google Pagerank:
Alexa Rank: 107,853
Domain Authority: 45 ON 100
DMOZ Listing: No

Web Server Information

Hosted IP Address:

Hosted Country:

Russia RU

Location Latitude:


Location Longitude:

Page Title of old-games.ru
Old-Games.RU Скачать старые игры. Постоянно пополняемый архив со старыми компьютерными играми.
Meta Tags of old-games.ru
old, games, download, abandonware, forum, free, fallout, arcanum, blood, duke nukem, heroes of might and magic, half life, starcraft, ultima, jagged alliance

Page Resources Breakdown

Homepage Links Analysis

Social Engagement

Facebook Shares: 78
Facebook Likes: Not Applicable
Facebook Comments: Not Applicable
Twitter Count (Tweets): 42
Linkedin Shares: Not Applicable
Delicious Shares: Not Applicable
Google+: Not Applicable

Website Inpage Analysis

H1 Headings: Not Applicable H2 Headings: Not Applicable
H3 Headings: Not Applicable H4 Headings: Not Applicable
H5 Headings: Not Applicable H6 Headings: Not Applicable
Total IFRAMEs: Not Applicable Total Images: Not Applicable
Google Adsense: Not Applicable Google Analytics: Not Applicable

Domain Information

Domain Registrar: RUCENTER-REG-RIPN
Registration Date: 2005-11-24 1 decade 1 year 10 months ago
Expiration Date: 2012-11-24 4 years 10 months 3 weeks ago

Domain Nameserver Information

Host IP Address Country
ns1.nameself.com Russia Russia
ns2.nameself.com Russia Russia

Similarly Ranked Websites

Oops, you come to undefined page

- escorts.sammyboyforum.com

  107,854   $ 63,600.00

Work To Inspire presents the THE BUZZ that you need for everything...

- worktoinspire.com

Community. Buzz. Rotator Technology. Business Promotion. Team Building Tools. Everything you need to RANK your business.

  107,856   $ 63,600.00

News, Weather, Sports in Youngstown Ohio | WKBN.com

- wkbn.com

WKBN 27 First News is the local source for breaking news, severe weather, investigative news and sports in Youngstown, Ohio.

  107,856   $ 63,600.00

Robinson Technologies - Home

- rtsoft.com

Robinson Technologies, a cool indie game maker.

  107,858   $ 63,600.00

Libertarian Party | Maximum Freedom, Minimum Government

- lp.org


  107,859   $ 63,600.00

Alexa Traffic Rank

Alexa Search Engine Traffic

Comments / Ratings / Reviews / Feedbacks for old-games.ru

Upcoming Events

xx/xx/xx:  Special Sale on all products from noon until 3:00 pm!

xx/xx/xx:  Mayor Bob will be on hand for the ribbon cutting ceremony marking the opening of our newest location!

xx/xx/xx:  More stuff!