I want the user to upload a file within the form and open the file on submission and read each row in sequence To get information about it to store in the database So far, I'm able to create only one object and remove it from it.
def upload file = request.getFile ('name_of_file') it gets me a commons multipurpose file, but I'm not sure that the file Need to stream in buffer, or save the file to a temporary folder and then try opening it like this
uploadedFile.getbytes () will give me an array [71] , 101, 110, 101, 114, 97, 108, 13, 10, 45, 45, 45, 45, 45, 45, 45, 13, 10, 83, 116 ....] that is not in one form, I can do anything. I should be able to open the file and read it row by row. Can I do it with the Commons Multipartfile - its options seem like limited
commonsultiplepart file < There is a getInputStream () method in inputstream on which you can call a Groovy enhancement, for example: request.getFile (' Name_of_file '). Inputstream.eachLine {line -> / * Parsing logic * /}
Comments
Post a Comment