Forum: Ruby on Rails Simple file upload help

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
24b05e200310d4673bf93e9349067887?d=identicon&s=25 Paul Sturgess (Guest)
on 2006-02-25 14:34
(Received via mailing list)
I'm trying to implement the simple file upload example at
http://wiki.rubyonrails.com/rails/pages/HowtoUploadFiles

However, I'm getting an error "No such file or directory" when I
submit the form...

Errno::ENOENT in Admin/websites#create
No such file or directory - /images/websites/websitename.jpg

I believe it's relating to the code in the model:

def self.save(website)
    File.open("/images/websites/#{website['name']}.jpg", "w") { |f|
f.write(website['filename'].read) }
end

>From what I understand it is trying to open the file at
/images/websites/websitename.jpg which doesn't exist. I'm not entirely
sure how this file upload is supposed to work, but essentially I just
want a simple upload that places a file into that location from my
public directory.

Any help would be greatly appreciated,
Paul.
This topic is locked and can not be replied to.