• Post Reply Bookmark Topic Watch Topic
  • New Topic

File Upload Problem  RSS feed

 
aniruddha gaikwad
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am using org.apache.commons.fileupload.fileItem to upload the file. I upload the file and stored its data in the DB, If the file contain special character like quotes, the string before quotes is only stored in DB, is there any way to solve this problem.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Files are binary data; any attempt to deal with them as if they were text is bound to fail. You need to use a Blob field in the DB, or convert the file contents to an ASCII representation before storing it in a text field in the DB (base-64 should work fine).

(The particular problem with quotes would also be solved by using a PreparedStatement.)

I generally advise to store file contents in the file system, though, and use the DB only for file metadata and such.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!