Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1716
  • Last Modified:

c#, asp.net - filling a text box when FileUpload textbox is filled

Hi,

I want to populate a textbox with the text of the textbox in a FileUpload.Once a file has been choosen and placed in the fileupload text box I want  textbox ID="fakefilepc"  to display the same text.  Does anyone know how to do this?

thanks
<asp:FileUpload ID="picFileUploadPhoto" runat="server" Width="250px" ></asp:FileUpload>// file to take Text from
 
 
 
<asp:TextBox ID="fakefilepc" runat="server"></asp:TextBox>// populate this text box

Open in new window

0
CharlieDev
Asked:
CharlieDev
1 Solution
 
Maverick_CoolCommented:
fakefilepc.text = picFileUploadPhoto.PostedFile.FileName;
0
 
cauosCommented:
add this javascript function to your page
<script language="javascript">
function change()
{
var obj1 = document.getElementById("picFileUploadPhoto")
var obj2 = document.getElementById("fakefilepc")
obj2.value=obj1.value
}
</script>
and this event to the file uploader
<asp:FileUpload ID="picFileUploadPhoto" onchange="change()"  runat="server" />
0
 
CharlieDevAuthor Commented:
Thanks!!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now