List Info

Thread: copying the file in local hard drive to the text field in the web using WATIR




copying the file in local hard drive to the text field in the web using WATIR
user name
2006-10-15 08:15:24
In my previous inquiry, I have received the below
suggestion; I was
inquiring how I can copy a file in my hard drive to the text
field in
the web.

Yes, below code works!!!  but each file I need to upload is
quite
lengthy, and I have many hundreds of them.

When I run the code below, WATIR is reading the file in my
hard drive a
character by character into the text field in the web; it
simply takes
too long.

Is there anyway I can copy the file in my hard drive in its
entirety
all at once, and paste it to the text field in the web at
once??  That
way I do not have to wait till the code reads a character by
character.. and the job will be done much faster..

any suggestion or help will be deeply appreciated.

thanks.

m.
============================================================
==========

Well, what you're doing is just taking the contents of the
variable
$Path and setting it to the text field. You'll actually need
to open
and read the file. For example...

ie.text_field(:name,
"html_text").set(File.new($Path).read)


That should do it. 


M.T.


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )