string m_file = AsyncFileUpload1.PostedFile.FileName;
AsyncFileUpload1.SaveAs(Server.MapPath("Currency/" + m_file));
But File not save at target folder? What's Problem ?
But File not save at target folder? What's Problem ?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Praneeth KumarRank #4,422 · 344 reputationPosted Jun 7, 2011, 10:08 PM EDT
Is the path correct which you have given for saving?
I hope you are not using Ajax Update panel as I remember in the update panel AsyncFileUpload1.PostedFile.FileName usually comes as empty. If that is the case add a postback trigger for the button.
Sandeep ShekhawatRank #2,439 · 577 reputationPosted Jun 7, 2011, 10:17 PM EDT
(i)Does the folder have rights to save?
YES,Folder at local machine it has permission of save and access.
(ii)Is the path correct which you have given for saving?
YES,Currency Folder is in root directory and my web content form is also in root directory.
(iii)I hope you are not using Ajax Update panel as I remember in the update panel AsyncFileUpload1.PostedFile.FileName usually comes as empty. If that is the case add a postback trigger for the button.
I am using Master Page and Content Page ,Master Page have ScriptManager and Content page contain Update Panel.Button and AsyncFileUpload controls are in Update Panel so i think i not need add to postback trigger.
AsyncFileUpload1.PostedFile.FileName has same string that i want it is not empty.
I think now u can help me.
Thanx
Praneeth KumarRank #4,422 · 344 reputationPosted Jun 7, 2011, 10:33 PM EDT
Sandeep ShekhawatRank #2,439 · 577 reputationPosted Jun 7, 2011, 10:43 PM EDT
When i clicked on rar file it display error.I could not download at my end. Please copy paste code here for me.
Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Jun 7, 2011, 10:45 PM EDT
AsyncFileUpload1.SaveAs(Server.MapPath("~/Currency/" + m_file));
or
AsyncFileUpload1.SaveAs(Server.MapPath("../Currency/" + m_file));
OR
Check the in download file:
Praneeth KumarRank #4,422 · 344 reputationPosted Jun 7, 2011, 11:18 PM EDT
using System;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnUpload_Click(object sender, EventArgs e) {
if (AsyncFileUpload1.HasFile) {
string strPath = MapPath("~/Currency/") + Path.GetFileName(AsyncFileUpload1.PostedFile.FileName);
AsyncFileUpload1.SaveAs(strPath);
}
}
}
Aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
Suthish NairRank #92 · 22.8K reputationPosted Jun 8, 2011, 2:13 AM EDT