Total Pageviews

Thursday 30 July 2015

Http 500 error on file upload

Problem- On local machine file upload works but on server it is giving me http 500 error.

Solution:- Check folder permissions and make it write ,read,delete for anonymous users on hosting server.

Also in coding use input stream after upload.

using System.IO;

   file = context.Request.Files[0];
                string filename = file.FileName;


                //Upload video code
                string a = filename.Trim();
          

  file.SaveAs(HttpContext.Current.Server.MapPath("~/videos/") + a);
                Stream streamfile = file.InputStream;