Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 423

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 423

Warning: Cannot modify header information - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 426

Warning: Cannot modify header information - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/templates/ja_purity/ja_templatetools.php on line 49
Upload Microsoft Word file using ASP.NET - The Scripts Library Community

Free Programming Tutorials & Source Code

 
  • Increase font size
  • Default font size
  • Decrease font size
Home ASP.Net Upload Microsoft Word file using ASP.NET

Upload Microsoft Word file using ASP.NET

E-mail
(2 votes, average: 4.50 out of 5)
Normal 0

Normal 0

This function allows you to upload a Microsoft Word file and put it on the server using ASP.NET.

Normal 0 Add the following controls to the aspx file, inside a form tag:
 




The code behind file:  
  protected void upload_file_Click (object sender, EventArgs e)
               {
                   bool val = false;
                   int x = uploader.FileName.LastIndexOf('.');
                   int y = uploader.FileName.Length;
                   string file_ext = uploader.FileName.Substring(x, (y - x));
                   if (uploader.HasFile)
                   {
                       if (  (file_ext == ".doc"))
                       {
                           uploader.SaveAs(Server.MapPath("~/") + uploader.FileName);
                           msg.Text =  " File successfully uploaded";
                       }
                       else
                       {
                           msg.Text = "Error. Please choose a document to upload";
                       }
                   }
               }