Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6750237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:47:03+00:00 2026-05-26T12:47:03+00:00

I am using FileUpload Control to upload images, I can select the image using

  • 0

I am using FileUpload Control to upload images, I can select the image using that browse button, but when i try to preview that selected one, i am not getting the file name, its showing empty..

protected void btnImgUpload_Click(object sender, ImageClickEventArgs e)
{
    try
    {
        string strimage;
        string strfilename, strextn;
        if (fupImage.HasFile)
        {

In the above code,fupImage.FileName property should have to selected Image name, but it remains as empty string “” , so fubImage.HasFile condition is going false. I am not getting why the condition is going false, while the file is selected,? what is the problem here?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:47:04+00:00Added an answer on May 26, 2026 at 12:47 pm

    what i did to test it is
    I create an Asp page

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
    
            <asp:FileUpload ID="fupImage" runat="server" />
            <asp:Button ID="btnImageUpload" runat="server" onclick="btnImageUpload_Click" 
                Text="Upload" />
    
        </div>
        </form>
    </body>
    </html>
    

    and the code behind class is

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace WebApplication2
    {
        public partial class WebForm1 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
    
            }
    
    
            protected void btnImageUpload_Click(object sender, EventArgs e)
            {
                try
                {
                    string strimage;
                    string strfilename, strextn;
                    if (fupImage.HasFile)
                    {
                        //do something
                    }
                }
                catch
                {
                }
            }
        }
    }
    

    and nothing goes wrong with that

    I want to say to test it just create a very simple instance and test it in complex environment may be there are some extra rules may prevents normal jobs! and sometimes it looks so unnoraml

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a fileupload control to upload images. The upload is working but I
I need to upload images using FileUpload without postback(using Ajax).I tried many examples.But in
I am using FileUpload control to facilitate Image file upload on my website. I
I want full path of selected file using GWT by using FileUpload. Can you
Greetings! I am using the ASP.NET FileUpload control to allow users to upload text
I have a Web Application in which I am using asp:FileUpload Control to upload
I'm using the FileUpload server control to upload a HTML document previously saved(as webpage;
I want to upload a file using FileUpload Control in asp.net and i'm using
I am trying to upload images on a form but I am using Jquery
I am using FileUpload control in my webpage it is working but my requirement

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.