Hello i got hidden FileUpload control, textBox where i wanna write url adrres or! filepath to some file, and button for call FileUpload. My problem is that I need instantly after user checks in fileupload control some file and close popup window, fill TextBox with filepaths of that file. I know how show filepath but i need do it automatically and that trap for me. Here is what i got so far. Last piece of code is how i got filepath but I need that user use FileUpload protected void Page_Load(object sender, EventArgs e)
{
btnFileUpload.Attributes.Add(
"onclick",
"document.getElementById('" + FileUpload2.ClientID + "').click();");
}
if (FileUpload2.PostedFile != null)
{
TextBox2.Text = System.IO.Path.GetFullPath(FileUpload2.PostedFile.FileName);
}
Alexander DrackaPosted Aug 18, 2013, 12:27 PM
Iftikar HussainPosted Aug 17, 2013, 12:21 PM
Regards,
Iftikar
Alexander DrackaPosted Aug 17, 2013, 12:20 PM
Iftikar HussainPosted Aug 17, 2013, 12:11 PM
function SetFilePath()
{
var filePath = document.getElementById("FileUpload2").value;
document.getElementById("TextBox2").value=filePath;
}
Regards,
Iftikar
Alexander DrackaPosted Aug 17, 2013, 11:58 AM
function Test() {
var fu1 = document.getElementById("FileUpload2"); document.getElementById("TextBox2").value = fu1.value; }
Iftikar HussainPosted Aug 17, 2013, 11:55 AM
in .css
Regards,
Iftikar
Alexander DrackaPosted Aug 17, 2013, 11:48 AM
Iftikar HussainPosted Aug 17, 2013, 11:09 AM
Alexander DrackaPosted Aug 17, 2013, 10:55 AM
<asp:FileUpload ID="FileUpload2" runat="server" Width="317px"
style="display: none" onchange="Metoda"/>
Iftikar HussainPosted Aug 17, 2013, 10:49 AM
I bit confuse about your query. By using the above code you are not getting complete path in your textbox?
Regards,
Iftikar