November 30th, 2001, 05:09 PM
Simple text file upload from a form?
Can anyone point me in the right direction for a decent tutorial on uploading a file from an html form for use in a jsp page?
I am trying to enter comma separated data from a web page into a database. I have already tried doing it using a <TEXTBOX>, submitting it to my jsp program as a String and using StreamTokenizer() but I think that <TEXTBOX> must do something to the text as no matter what I try I cannot get StreamTokenizer to recognise end of lines.
So now I am thinking about allowing the user to upload a .csv file containing the data to the page. I have found some information here:
but it seems quite complicated and a little more than I actually need (I only need to upload one file, not multiple files, or impose lots of restrictions on the types of files to be uploaded etc. as a lot of the sample codes provide).
Does anyone out there know of a good simple tutorial on how to do this? Or does anyone have the source code for a simple, single file uploader that allows me to simply open the file uploaded as a 'Reader' object (or something that can be converted into one) so I can fire it into my StreamTokenizer?
Think of the most annoyingly simple question and I've probably asked it on here!