Click here to Skip to main content
15,889,315 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
File Upload does functions well in Google Chrome and Firefox. Can locate the file but on Upload it says the file path is incorrect.

C#
protected void FileUploadLABMinutes_Load(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
    {
        lblMessage.ForeColor = System.Drawing.Color.Red;
        if (FileUploadLABMinutes.HasFile)
        {
            try
            {

                string filename = FileUploadLABMinutes.FileName;

                Session["Filename"] = filename;
                string extension = filename.Substring(filename.LastIndexOf('.') + 1);
                if (extension == "pdf")
                {
                    lblMessage.ForeColor = System.Drawing.Color.Blue;
                    string path = Server.MapPath("Upload/") + FileUploadLABMinutes.FileName;
                    FileUploadLABMinutes.SaveAs(path);

                    lblMessage.Text = "File uploaded successfully!";

                }
                else
                    lblMessage.Text = "Upload status: Only pdf files are accepted!";
            }
            catch (Exception ex)
            {
                lblMessage.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
            }
        }
        else
        {
            lblMessage.Text = "Please select a file to upload.";
        }
    }
    protected void btnUpload_Click(object sender, EventArgs e)
    {


        string path = Server.MapPath("Upload/") + FileUploadLABMinutes.FileName;

              HyperLink1.NavigateUrl = "Upload/" + FileUploadLABMinutes.FileName;


Thanks in Advance
Kaliopasa
Posted
Updated 6-Feb-13 12:29pm
v3
Comments
Sergey Alexandrovich Kryukov 11-Oct-12 20:03pm    
Do I have to report it as off-topic? Do you wonder why?

This forum is for software developers and students. And software developers don't say "it does not work"; they provide comprehensive issue reports.
--SA
Sergey Alexandrovich Kryukov 11-Oct-12 22:19pm    
And..? Any more updates to the question? For example, you could log the path, so we could know what it is, in what cases...

Do I have to explain what's "comprehensive"? Basically, it's as you had to answer the question yourself, and you would be able to get all information you would need to figure out what's going on. Please understand that now, due to the end of vacation season, my access to your hard drive is somewhat limited. :-)
--SA
Sushil Mate 12-Oct-12 0:30am    
After reading your comments, I don't think so he will come to give you a comprehensive issue reports. ;)
Sergey Alexandrovich Kryukov 12-Oct-12 11:31am    
Well, let's wait another day or so. We have a lot of hanging request, need to remove as many hopeless questions as possible, but who would do it?
-SA

C#
protected void FileUploadLABMinutes_Load(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
    {
        lblMessage.ForeColor = System.Drawing.Color.Red;
        if (FileUploadLABMinutes.HasFile)
        {
            try
            {

                string filename = FileUploadLABMinutes.FileName;

                Session["Filename"] = filename;
                string extension = filename.Substring(filename.LastIndexOf('.') + 1);
                if (extension == "pdf")
                {
                    lblMessage.ForeColor = System.Drawing.Color.Blue;
                    string path = Server.MapPath("Upload/") + FileUploadLABMinutes.FileName;
                    FileUploadLABMinutes.SaveAs(path);

                    lblMessage.Text = "File uploaded successfully!";

                }
                else
                    lblMessage.Text = "Upload status: Only pdf files are accepted!";
            }
            catch (Exception ex)
            {
                lblMessage.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
            }
        }
        else
        {
            lblMessage.Text = "Please select a file to upload.";
        }
    }
    protected void btnUpload_Click(object sender, EventArgs e)
    {


        string path = Server.MapPath("Upload/") + FileUploadLABMinutes.FileName;

        ShowPdf1.FilePath = "Upload/" + FileUploadLABMinutes.FileName;
        ShowPdf1.DataBind();

        HyperLink1.NavigateUrl = "Upload/" + FileUploadLABMinutes.FileName;
 
Share this answer
 
I think you use update penal so not work in IE.
Please Set Trigger in code behind language .
 
Share this answer
 
Hi please provide the code so, that it is easy for us to correct it in case it is wrong.
 
Share this answer
 
Comments
SameerNA 12-Oct-12 15:29pm    
is this a solution?

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900