Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Internet Explorer COM object
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00817045
Message ID:
00818743
Views:
15
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")

*** Set mode to multi-part form
oHTTP.nHttpPostMode = 2

*** Post a file and a regular form variable
oHttp.AddPostKey("File","d:\temp\wws_invoice.pdf",.T.)

*** Any other regular form variables
oHttp.AddPostKey("txtFileNotes","test note")

*** Send the POSt data and retrieve the result
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.asp

SET PLUG OFF

Regards,

+++ Rick ---
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform