Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Please help me.......MIME Type for XLS file

Please help me.......MIME Type for XLS file

Scheduled Pinned Locked Moved ASP.NET
helpsysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cheguri
    wrote on last edited by
    #1

    Dear Friends, I have written the following code to upload .xls file. I want to upload only .xls file. if (fuploadPaySlip.HasFile) { if (fuploadPaySlip.PostedFile.ContentType == "application/x-msexcel") { fuploadPaySlip.PostedFile.SaveAs(Server.MapPath(".") + "//uploadedfiles//" + fuploadPaySlip.FileName); lblErrorMsg.Text = "Uploaded Successfully"; } else lblErrorMsg.Text = "Not a valid File"; } else lblErrorMsg.Text = "No File is Selected"; but it is always saying "Not a valid file". I have even tried with other MIME Types like application/excel application/vnd.ms-excel application/x-excel Still I am getting error. Please anyone can help me. Its very urgent. Regards, Dileep.

    S 1 Reply Last reply
    0
    • C cheguri

      Dear Friends, I have written the following code to upload .xls file. I want to upload only .xls file. if (fuploadPaySlip.HasFile) { if (fuploadPaySlip.PostedFile.ContentType == "application/x-msexcel") { fuploadPaySlip.PostedFile.SaveAs(Server.MapPath(".") + "//uploadedfiles//" + fuploadPaySlip.FileName); lblErrorMsg.Text = "Uploaded Successfully"; } else lblErrorMsg.Text = "Not a valid File"; } else lblErrorMsg.Text = "No File is Selected"; but it is always saying "Not a valid file". I have even tried with other MIME Types like application/excel application/vnd.ms-excel application/x-excel Still I am getting error. Please anyone can help me. Its very urgent. Regards, Dileep.

      S Offline
      S Offline
      Sandeep Mewara
      wrote on last edited by
      #2

      Try:

      ContentType = "application/vnd.xls";

      Another thought to the issue, you using Office 2003 or 2007? Both have different extensions to excel files, might that be the reason!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups