Click here to Skip to main content
15,906,708 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
using <anchor> tag i am not able to view uploaded files.while view some extra characters is coming.like "file//+Pathname" i need only path name not prefix value ..please give a solution avoid prefix string
Posted
Updated 22-Jun-11 1:21am
v2

I think this will help you


C#
if(FileUploadControl.HasFile)
    {
        try
        {
            string filename = Path.GetFileName(FileUploadControl.FileName);
            FileUploadControl.SaveAs(Server.MapPath("~/") + filename);
            StatusLabel.Text = "Upload status: File uploaded!";
        }
        catch(Exception ex)
        {
            StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
        }
    }
 
Share this answer
 
Comments
Gunainfo 22-Jun-11 7:37am    
after upload i want view without store in System folder.
[no name] 22-Jun-11 7:42am    
ahter upload simply write
Response.Write("<img src='~/filename.ext'/>");
Gunainfo 22-Jun-11 8:00am    
grid i want list all the file.
parmar_punit 22-Jun-11 8:45am    
then take datalist or repeater control to display all the file....

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