File upload

I'm not sure why it isn't working. Did you look at your generated HTML and check that everything looks the way it should? I struggled with getting uploading files to work for a while and just got it recently. I don't know if there's some disadvantage to doing it this way, but I just put my file writing code in the controller and pull straight from my params.

For some reason, even though I have the regex, I was getting one param each time that didn't contain a file, so I had to put the next statement in. Now it works fine, though I should probably include a gsub call as well.


params.each { |key, value|
      if /file_\d+/.match(key)
        next if (!filename = params[key].original_filename.split('/').last) filename, "wb") { |f|

Petr wrote: