Upload File On A Server. (Code For File Upload On A Server ASP.net)

Upload File on Server.

 public void upload_cv()
        if ((Resume_Upload.ToString().Trim() != ""))
            string UploadPath = "";
            string encry_path = "";
            string file_name = "";
            string file_extension = "";
            file_name = Resume_Upload.PostedFile.FileName.ToString();
            file_name = file_name.Substring(file_name.LastIndexOf(@"\") + 1);
            file_extension = file_name.Substring(file_name.LastIndexOf(".") + 1);
     if ((file_extension.ToString().ToUpper() != "DOC") 
|| (file_extension.ToString().ToUpper() != "PDF") || 
(file_extension.ToString().ToUpper() != "RTF") ||                  
     (file_extension.ToString().ToUpper() != "TXT"))
         //Upload file on A Specific folder.

    UploadPath = Server.MapPath(Request.ApplicationPath + @"\upload\");
     Resume_Upload.PostedFile.SaveAs(UploadPath + file_name + "." + file_extension);
               catch (Exception ex)
                        lbl_error.Text = ex.ToString();

            lbl_error.Text = "Please Upload MS Word file(.doc) only";


Just Call Above Function.On Some Event.HowEver You Can Also Make Security tricks to protect your file From hacker For that you Can Make File name Encrypted.

Enjoy !!!!!!!!!1

Prev Post                                                      All Post                                                           Next Post

Posted in | 0 comments

Site Map

Invalid post back or callback argument,Asp.Net 2.0


Grid view

What is IL ?


Custom Error Handling in ASP.Net
Upload File on Server. (Code for File upload  in ASP.Net)
Connection String :- Asp.net Application with MS Access
Dynamic change URL of Web Service
ASP.Net Problems and Solution :-
            invalid parameter accessor: 1 BADBINDINFO.
                  CrystalReport 10.0 Dynamic Image Display Problem 
Date Time Format In SQL Server and MS Access.
Encrypting and Decrypting Configuration Sections in   web.config
Encryption and Descryption class in Asp.Net
Treeview Example in Asp.Net 2.0
Tab control in Asp.net Without third Party control 
Open child Window From Parent Window using Java script and on closing refresh.
Maintain Check box State in Grid view While Paging in Asp.net
Desktop Application run from Web Application on Server and Pass Arguments.
Sending email using Asp.Net 2.0
Merge Cell In grid view Header in Asp.net 2.0 
Highlighting the current menu item From Collection of menu  Items
Coding to Populate State and city According to State Selection Without Postback
Convert Image to byte array and  byte array to image in Asp.net
Bookmark in Asp.Net
Submit you Idea
Ask Your Question 
Share Good Documents


Posted in | 0 comments

Connection String Asp.Net With MsAccess

Connection String
Connect Asp.Net Application With MS Access.

First Open Web.Config of your Application and Write Down Following Code in Web.Config File.

in appSettings tag
add key="constr" value="Provider=Microsoft.Jet.Odbc.4.0;DSN=resume;User Id=admin;Password=admin;"

end appSettings tag

Now open your Application and write down following Connection String

OdbcConnection Objcon = new OdbcConnection(ConfigurationManager.AppSettings["constr"]);

Now Objcon Object you can use as Connection Object

if any query then just reply me.

Prev Post                                                      All Post                                                           Next Post

Posted in | 4 comments