Click to See Complete Forum and Search --> : Fill Input File Type box on a web page
iamlp
April 2nd, 2001, 09:02 PM
I am trying to automate filling a form on the Web.
I have a file type input box and how can I put values on that Text box? I was able to put values into common text boxes other than type "File".
Anybody has any ideas???
Here is a sample htm file which has a file input box.
Test.htm
--------
<p align=left>Enter name of TEXT file:<input id="file1" name="txtFile" type="file" ></p>
</p>
Jean-Guy2000
April 3rd, 2001, 10:23 AM
This cannot be done because the file type text box is client side and you have no control of the value. I tried for fun using this to test it. you can set smelly input box but not the file one.
<body>
<form name="filer">
<p align="left"> Enter name of TEXT file:<input id="file1" name="txtFile" type="file"></p>
<P>Yoshi <input id="txtoknow" name="smelly"></P>
</form>
</body>
<script Langauge=javascript>
window.onload = document.forms[0].smelly.value = "C:\\test.txt"
</script>
dartsbeerman
June 1st, 2001, 02:32 PM
Did you ever find a solution to this problem?
I am also trying to pre-fill a form (on the client side). I can use the DOM to get input elements and set their value (xx.value = "abc"). This works for input type = text, and input type=password. However, it does not work for input type=file.
Any clues?
iamlp
June 1st, 2001, 03:09 PM
Yes, I did.
I had to use a third party control to do this.
The control CSINet is available at
http://web.singnet.com.sg/~kegoh/CSInet.htm.
Try it out..
Here is an example of code.
CSControl1.URL = "http://localhost/abc.htm"
CSControl1.clearfile
CSControl1.Addfile "txtfile", "C:\a.txt"
CSControl1.abort
strRes = CSControl1.Upload
Makesure that URL property for the CSInet should be the page which you are trying to post.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.