Topic: Rails load xml file and parse it in nokogiri?

In my first rails app I need to upload from pc xml file and parse it. I try this method for upload:

def file_upload
    tmp = params[:file_upload][:my_file].tempfile
    require 'ftools'
    file = File.join("public", params[:file_upload] [:my_file].original_filename)
    @ll = params[:file_upload] [:my_file].original_filename
    File.cp tmp.path, file

and view

= form_for :file_upload, :html => {:multipart => true} do |f|
    = f.file_field :my_file
    = f.submit "Upload"

But nothing goes... in my public folder I didn't get any new files...

Moreover then i need to send this file to nokogiri... parse there... and then update in db fileds as they values in xml. But now main problem is to load file, also when i try to create empty file in method i didn't have any new files.

Re: Rails load xml file and parse it in nokogiri?

in most OS's empty files will never exist. Not sure what (if anything) is wrong with your code. Looks good to me.
Make sure you upload a file with content
Make sure that you understand what folder the files are going to be saved to
Make sure the app has permissions to write to that folder
Check the contents of your log file to see what is happening

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)