This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
"new String(dataBytes)" is almost certainly incorrect. Files are binary data - they can't be converted to a string. And even if they are text, this call disregards the question of which encoding the file contents are in.
But more importantly, is there a particular reason you're trying to reinvent the wheel? HTTP file upload is rather complex, and has been comprehensively solved by libraries like Apache Commons FileUpload.
Joined: Apr 18, 2007
reason being, my requirement is demanding me not to go with any third party software though its free.
Srinivasa Maddi wrote:reason being, my requirement is demanding me not to go with any third party software though its free.
I really don't understand why ones always come up with such lame excuse? Where does this aversion come from?
Apache Commons FileUpload is a well developed and thoroughly tested file upload API. Honestly, with the knowledge you've shown as far, you would require and waste too much time to achieve the same robustness as Apache Commons FileUpload. That isn't worth the effort.