• Post Reply Bookmark Topic Watch Topic
  • New Topic

FileForm  RSS feed

John Lark
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey All,

I am currently working on a project in which I must import the Contents of a file from a users computer, then save the contents to the database. My Original attempt was to get the file location using <html:file> as a string and loading the acctual however, this failed miserably so I have resorted to using FileForm. My latest attempt is to pull it from the form, use a getInputStream(). Convert the Input Stream into a Document(its XML) like so Document DocYadda= db.parse(InputStreamYadda). I then convert it to a string and input it into the database. The String value displayed is [#document: null]!? Even when I use JOption to take a peak before it gets put into the database, I get this same result. I know its getting the Content because I can see it using Firefox's Data Tamper, somthings happining between the form and the database though that I just cant figure out? Any ideas on what this could possibly be? Is there somthing special that must be done in order to convert the Code to a stream.

InputStream InputSTreamYadda= BeanYadda.getFileForm.getInputStream();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document DocumentYadda= db.parse(InputSTreamYadda);
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!