File uploading or manipulating the file upload buttons/input box is not supported through the DOM object model and for good reason. This is a huge security problem if you could just upload files from within script code.
Using WSH, using SendKeys will work, but I'd say that's using the wrong tool - you're introducing a lot of dependencies in your application for a relatively simple task. Plus WSH is disabled on many machines or enabled only for administrators due to security concerns.
The better solution is the one Brian mentioned and that is to use a dedicated HTTP tool that can provide this functionality. Brian's is one tool, West Wind also has wwIPStuff which includes the capability to upload files as well as posting data to the server with a few lines of code.
The code for this is very simple:
oHTTP = CREATEOBJECT("wwHTTP")
oHTTP.nHttpPostMode = 2
oHttp.AddPostKey("File","d:\temp\wws_invoice.pdf",.T.)
oHttp.AddPostKey("txtFileNotes","test note")
lcHTML = oHTTP.HTTPGet("http://localhost/wconnect/FileUpload.wwd")
This will certainly make for a much cleaner path for sending and retrieving Web content unless you need to fully automate a very complicated process of pages.
SET PLUG ON
Shareware version of West Wind Internet Protocols that includes HTTP, FTP, SMTP/POP3 and Soccket support, to try this out and work with it is available at:
http://www.west-wind.com/wwIPStuff.asp or if you're interested in additional components that also include this
http://www.west-wind.com/wwClientTools.aspSET PLUG OFF
Regards,
+++ Rick ---