I am using RadUpload control of telerik. I have added Rad upload on page and one asp Text box. what I want to do is OnClientFileSelected event selected file path get added in asp Text box at client side. I did tried following ways but i got only file name i.e. test.text or test.doc. I do want to add entire path in asp text box like "C:\folder1\folder2\test1.txt". How should i do this.
function fileSelected(radUpload, eve开发者_StackOverflow社区ntArgs)
{
var input = eventArgs.get_fileInputField().value;
document.getElementById("<%= txtPath.ClientID %>").value=input;
}
Thanks In Advance
You cannot do it client side without a little extra help since the client has next to no information about the server. Try setting a hidden field from the server side to store the file path.
HiddenField1.Value = HttpContext.Current.Server.MapPath("~/my_upload_directory/")
Then on the client side, you just concatonate the HiddenField1.value
and the txtPath.value
var fullPath = document.getElementById("<%= HiddenField1.ClientID %>").value + document.getElementById("<%= txtPath.ClientID %>").value;
精彩评论