I am writing a program which takes info from a client side database and fills in a PHP form. There is no problem with most of the common text input elements. However, one of the elements is a file upload input type.
My program simply rewrites the code of the webpage to add the appropriate value to the text input element however, this doesn't work for the file upload input (where I want to upload a jpeg from the user side's PC to the web site). It seems that the the file upload element is designed such that the user must explicitly nominate the file to be uploaded (I guess in order to protect the privacy of the user). To get around this, I am using SendKeys to fill out the file upload element with the appropriate file name which works most of the time. But I really don't like SendKeys as I find it erratic and I am looking for another way to program the value of the file upload input element.
I tried an experiment using DHTML with a Command Button that sets the value of the input elements and this works fine for the text inputs but still not for the file upload element
e.g. PhotoFileUpload.value = "C:\MyPictures\Bart.jpeg"
The code doesn't cause an error, but the browser fails to recognise the value until it is typed in by the user.
Does anyone know if it is possible to program the value of the file upload web page input element without user intervention or without using SendKeys?
My program simply rewrites the code of the webpage to add the appropriate value to the text input element however, this doesn't work for the file upload input (where I want to upload a jpeg from the user side's PC to the web site). It seems that the the file upload element is designed such that the user must explicitly nominate the file to be uploaded (I guess in order to protect the privacy of the user). To get around this, I am using SendKeys to fill out the file upload element with the appropriate file name which works most of the time. But I really don't like SendKeys as I find it erratic and I am looking for another way to program the value of the file upload input element.
I tried an experiment using DHTML with a Command Button that sets the value of the input elements and this works fine for the text inputs but still not for the file upload element
e.g. PhotoFileUpload.value = "C:\MyPictures\Bart.jpeg"
The code doesn't cause an error, but the browser fails to recognise the value until it is typed in by the user.
Does anyone know if it is possible to program the value of the file upload web page input element without user intervention or without using SendKeys?