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:
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));
{
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.

Lakshmanan Sethu SankaranarayanRank #124 · 17.7K reputationPosted Feb 24, 2014, 7:56 PM EST
Biswa Pujarini MohapatraRank #465 · 5.4K reputationPosted Feb 24, 2014, 7:22 PM EST
http://www.codeproject.com/Articles/482800/FileplusUploadplusinplusUpdateplusPanel