0

If I use a file upload control in an ASP page and the user had uploaded PDF file, how I can get the content of this file?

lc.
  • 113,939
  • 20
  • 158
  • 187
Maaark
  • 1
  • possible duplicate of [How to correctly use the ASP.NET FileUpload control](http://stackoverflow.com/questions/2241545/how-to-correctly-use-the-asp-net-fileupload-control) – cbr Mar 03 '15 at 10:29

1 Answers1

0

You could used the PostedFile property to access the content of the file. Using PostedFile you can get the content length, contenttype etc. Also you can directly save the file as

sFileName = Path.GetFileName(FileUploadCtrl.value)
sFilePath = Path.Combine([your new path] , sFileName)
FileUploadCtrl.PostedFile.SaveAs(sFilePath)
  • okay , i know that PostedFile property to access the content of the file but it get the content in form of bytes and i want the content of file in form of text – Maaark Mar 03 '15 at 14:15
  • You can not extract text from pdf file. You will need an iFilter for this. See the sample in this code project link.. It will give you an idea of what i am saying. http://www.codeproject.com/Articles/13391/Using-IFilter-in-C – user3171825 Mar 03 '15 at 14:44