Użytkownik "Marko Vuksanovic" <ma*************@hotmail.comnapisał w
wiadomo¶ci news:73**********************************@microsof t.com...
>
I am trying to get the FilePath element of the FileUpload control to a JS
variable. As I am pretty new to JS I have no idea how to achieve that. I
would kindly ask someone to point me to the right direction,... such as
where I should start with JS and possibly the solution to my concrete
problem....
This is the relevant code:
<script type="text/javascript">
var fileUploadPath;
function UploadButtonClick()
{
//get the FilePath property to the fileUploadPath variable
alert(fileUploadPath);
}
</script>
<asp:FileUpload id="FileUpload" runat="server"</asp:FileUpload>
<asp:Button id="Upload" Text="Upload file" runat="server"
OnClientClick="UploadButtonClick()"</asp:Button>
It is a client-side JavaScript problem, so the solution is simple.
Just read the "value" property of the HTML file-input control.
Let's assume, that this control name is FileUpload then:
fileUploadPath = document.form_name.fileUploadPath.value;
ps.
Why do you need this ?
--
JS
BRE Bank Dev Team, Poland