Hello Sir

I have a problem in uploading a file in server ,so can u tell me how to upload any file in server.Suppose if i want to upload any resume in my asp page then tell me how to do this

In the .aspx page you need a fileupload control and an ok button as follows:

<asp:FileUpload ID="FileUpload_Resume" runat="server" />
        <asp:Button ID="btnFileUpload" runat="server" OnClick="btnFileUpload_Click" Text="OK" />

On the code behind OK button click do this:

string strFileLocation = System.AppDomain.CurrentDomain.BaseDirectory;
        //Get the application root directory

        if(FileUpload_Resume.HasFile)
        {
            string strFilePath = strFileLocation  + "\\" + FileUpload_Resume.FileName.ToString();

            FileUpload_Resume.PostedFile.SaveAs(strFilePath);
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.