2

I have a byte array that contains the data of an uploaded file which happens to be a Resume of an employee(.doc file). I did it with the help of the following lines of code

    AppSettingsReader rd = new AppSettingsReader();

    FileUpload arr = (FileUpload)upresume;
    Byte[] arrByte = null;
    if (arr.HasFile && arr.PostedFile != null)
    {
        //To create a PostedFile
        HttpPostedFile File = upresume.PostedFile;
        //Create byte Array with file len
        arrByte = new Byte[File.ContentLength];
        //force the control to load data in array
        File.InputStream.Read(arrByte, 0, File.ContentLength);
    }

Now, I would like to get the contents of the uploaded file(resume) in string format either from the byte array or any other methods. PS: 'contents' literally refers to the contents of the resume; for example if the resume(uploaded file) contains a word 'programming', I would like to have the same word contained in the string. Please help me to solve this.

Rohit Kiran
  • 436
  • 1
  • 5
  • 17

1 Answers1

0

I worked on a similar project a few years ago. Long story short... I ended up reconstructing the file and saving it on the server, then programmatically convert it to pdf, and then index the contents of the pdf, this proved much easier in practice at the time.

Alternatively, if you can restrict resume uploads to docx file format, you can use Microsofts OpenXML library to parse and index the content very easily. But in practict this may cause usability issues for users of the web site.

FastGeek
  • 411
  • 2
  • 7