how to create an array by reading text file in javascript

后端 未结 5 1155
日久生厌
日久生厌 2020-12-22 08:35

I have a text file with profanity word separated by comma (,). Now I have to create an array by reading this text file, each and every profanity word should be stored into t

5条回答
  •  心在旅途
    2020-12-22 09:14

    Technically you can do by - http://www.phpletter.com/Our-Projects/AjaxFileUpload/

    1. Upload file to your server side code, parse it back with json array
        def upload_file    
           data = params['fileToUpload'].read
           render :json => data.split(',')
        end
    
    1. In your client code

    < input type='file' size='25' name='fileToUpload'>

     
    

    1. In your ajaxFileUpload() method to handle the return data.split(',')

提交回复
热议问题