Cant upload file with mechanize

i try to upload a file with mechanize but i dont understand why i cant
I try with two differents params name and id but each time i get an

*Code: *
agent ={ |a| a.log =“Mechanize.log”) }
agent.read_timeout = 60
agent.user_agent_alias = ‘Linux Mozilla’
‘Linux Mozilla’ => ‘Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.4) Gecko/20030624’,
‘Linux Firefox’ => ‘Mozilla/5.0 (X11; U; Linux i686; en-US;
rv: Gecko/20100122 firefox/3.6.1’


     form ='form')[0][0]["login"] = "login"[0]["password"] = "password"
       res =[0].submit

 #uploadFile = => "file"))
 uploadFile = => "filepc"))

Error: *with id *
click': undefined method []’ for nil:NilClass (NoMethodError)
from mechanize.rb:33:in `’

Error: with name
(eval):14:in block (2 levels) in links_with': undefined method name’
#<Mechanize::Page::Link "

*HTML code *: