Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9092591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:52:42+00:00 2026-06-16T22:52:42+00:00

I need to select a csv file from local file system and display the

  • 0

I need to select a csv file from local file system and display the contents of that file as text using jquery.

I am using this for file Upload

<input id = "uploadCSV" type = "file" /> 

On its change event,

 $('#uploadCSV').change(function(e) {
 if(e.target.files != undefined) {
           var reader = new FileReader(); 
           reader.onload = function(e) {
           var lineSplit = e.target.result.split("\n");
           var commaSplit = lineSplit[0].split(",");
           var content = "";
           for(var i = 0; i < commaSplit.length; i++) {
                 var temp = commaSplit[i];
                 content = content + " " + temp;
           }
         };
         reader.readAsText(e.target.files.item(0));
         var fileContent = reader.result;
         alert(fileContent);
      }
 });

Somehow this doesn’t work and I get null in alert when I use Firefox. If I use IE8, it crashes as it cannot locate e.target.result. Please advise

I am looking for the simplest way of converting a csv file in my local file system into plain text.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T22:52:43+00:00Added an answer on June 16, 2026 at 10:52 pm

    I could resolve the issue by using asp.net mvc. See below for details

    @using(Html.BeginForm("ProcessCsv","<YourControllerName>",FormMethod.Post, new {enctype = multipart/form-data" }))
    {
         <input id = "myUpload" type = "file" name = "fileBaseParam"/>
         <input id = "btnSubmit" type = "submit" name = "ProcessCsv" value = "Submit" />
    }
    

    In your controller, define an actionresult,

    [HttpPost]
    public ActionResult ProcessCsv(HttpPostedFileBase fileBaseParam)
    {
           var csvReader = new StreamReader(fileBaseParam.InputStream);
           string fileContent = csvReader.ReadToEnd();
    }
    

    HttpPostedFileBase is the crucial concept here.. You can find more information on this from
    http://www.codeproject.com/Articles/442515/Uploading-and-returning-files-in-ASP-NET-MVC.

    Hope this information would help someone in future.

    Thanks

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to read data from a CSV file & display it as a
I have a flat CSV file which I need read from to end up
I have a datagrid in a WPF populated from a csv file. This is
I have a CSV file with records that need to be sorted and then
I'm using db2 export to save data to a CSV file. Ultimately I need
I follow the tutorial here to query content from CSV file: http://rudesyle.wordpress.com/2008/01/28/using-linq-to-query-a-csv-file/ However, the
What I need to do is export data into CSV file using T-SQL. And
I need to export csv file in php using mysql query .But when i
I have a data table I've loaded from a CSV file. I need to
I need to select elements without child node (including text since in <p> text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.