0

I have an code below normally this code get file from file input in view im MVC project. I have files in my local folder. I want to read these files without use file input in view. I have local paths of files. But I dont know how I can change file string to File

public static string UploadFile(string category = "external", string guid = null)
        {
            string result = "";

            HttpPostedFile file = HttpContext.Current.Request.Files.Get(0);

            result = Save(file.ContentType, category, guid, null, file);
            if (FILE_SAVE_ERROR.Equals(result))
                return result;
            if (string.IsNullOrEmpty(result))
                return result;

            return result + ";" + category;
        }

How can I solve problem, Thanks in advance

Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
  • 2
    You can't make the *browser* do anything from server-side code. You have to run code on the *browser*, although browsers typically don't allow uploading files without user interaction for obvious security reasons. Otherwise a malicious site could just start reading a user's files without notification – Panagiotis Kanavos Apr 07 '17 at 08:52
  • what do you mean "how I can change file string to File" exactly? – Majid Parvin Apr 07 '17 at 09:06

0 Answers0