Saving file to disk

how can i set the permission for the folder "12" so that i can save a
file in it?

Hi Nick,

How you do it is OS specific, but what you do is generally one of the
following.

You can ensure that your web server runs under the same user id as the
owner of that directory. You can also set up a group, give that
directory group write access, and then ensure that the user id that
your web server is running under is in the same group as the owner of
that directory. (I typically use this approach.) Finally, you can
give that directory world write access.

(You might also consider using an absolute path. Not that that will
fix the permissions issue.)

It looks like you're naming the directory to write to, but you're not naming the file. Does this help?

File.open("#{current_dir}/filename.ext", "wb") { |f| f.write(file.read) }