Click here to Skip to main content
14,175,662 members
Rate this:
Please Sign up or sign in to vote.
hey guys i think there is something wrong with my visual studio 2013. my fileupload is not provide any filename ,every time it is giving a null value , previously it was running correctly and upload a file too but now it is not working


i have create fileupload in webpage and a button to test that whether fileupload get a value or not.

<asp:Button ID="Button4" runat="server" OnClick="Button4_Click" Text="Button" />
                            <asp:FileUpload ID="FileUpload3" runat="server" />

protected void Button4_Click(object sender, EventArgs e)
       string fname = "", fn = "";
       fname = FileUpload3.FileName;


in the above simple code variable 'fname' is getting a null value always from fileupload.
what is the problem ? is this a problem with my visual studio?
Updated 17-Dec-14 18:12pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

If you use Updatepanel then copy this code under updatepanel:
<asp:PostBackTrigger ControlID="Button4" />
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

one posibility is that if you used update panel then fileupload will be become null.
if its not ,then
try to use FileUpload1.PostedFile.FileName;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web06 | 2.8.190524.3 | Last Updated 18 Dec 2014
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100