TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
rachayita jaiswal
NA
217
106.2k
Fileuplaod in asp.net
Feb 25 2014 12:00 AM
Hi,
I have file uplaod and button, but when I am selecting a image and click on button on my code behind file name is coming blank----
aspx page:
<tr>
<td><font color="red">*</font>Logo</td>
<td>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Label ID="lbl_imgupload" runat="server" style="color :Red"></asp:Label>
</td>
</tr>
<asp:UpdatePanel ID="updatePanelAction" runat="server" UpdateMode="Always">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btn_comp_submit" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Button ID="btn_comp_submit" Text="Submit" runat="server" OnClick="btn_comp_submit_Click" />
</ContentTemplate>
</asp:UpdatePanel>
aspx.cs page
protected void btn_comp_submit_Click(object sender, EventArgs e)
{
try
{
if ((FileUpload1.FileName != ""))
{
byte[] raw;
string extension = Path.GetExtension(FileUpload1.PostedFile.FileName);
if (((extension == ".jpg") || ((extension == ".gif") || (extension == ".png"))))
{
FileStream fs = new FileStream(FileUpload1.PostedFile.FileName, FileMode.OpenOrCreate, FileAccess.ReadWrite);
raw = new byte[fs.Length];
fs.Read(raw, 0, Convert.ToInt32(fs.Length));
...................................................................................
Please tell me the prob, Ihave used file upload before also but never faced this type of issue.
Reply
Answers (
2
)
MVC Exception Handling
Pdf file creation and automatic trigger that Pdf to peoples