0

I have a form where the user submits some details and a file of any kind, now since the file uploaded is of type HttpPostedFileBase, how can i arrange the reader from GetString in order to read the File Name of the uploaded file. Thanks

Error in Code

enter image description here

Properties

enter image description here

Mark
  • 15
  • 6
  • Does this answer your question? [ASP.Net MVC - Read File from HttpPostedFileBase without save](https://stackoverflow.com/questions/16030034/asp-net-mvc-read-file-from-httppostedfilebase-without-save) – Lady_A Apr 03 '20 at 13:15
  • Yes, i saw it but still confused on how to implement it – Mark Apr 03 '20 at 13:31
  • My problem is about what should i write instead of `reader.GetString(3)` I found this line which should return the File Name --> `string pathName = System.IO.Path.GetFileName(file.FileName);` – Mark Apr 03 '20 at 14:10

1 Answers1

0

Why not to check file extention by something like: f.Substring(f.LastIndexOf('.')+1, 3));

YuriyK
  • 11
  • 1