Are you looking for client code which can upload data through some protocol (HTTP, FTP, etc) to a server? Or are you looking for server code which can receive HTTP uploads?
ruba sampath
Greenhorn
Joined: Jun 17, 2011
Posts: 28
posted
0
Looking for client code which can upload data through some protocol (HTTP, FTP, etc) to a server
Paul's right. The way files are uploaded in HTTP and FTP is quite different, and for SMB (a.k.a. Windows file sharing), NFS or SCP it's again completely different.
For HTTP you'll first need a page that can handle the file upload; a servlet, JSP page, PHP page, ASP page, etc. The HttpClient library I mentioned can then handle the rest.
For FTP you can use Apache Commons Net or JvFTP.
For SMB you can use regular java.io.File if the rights allow it, or JCIFS otherwise.
For SCP you can use JSch.
Of course these aren't the only libraries to use, but they do seem to be the most commonly used.
ruba sampath
Greenhorn
Joined: Jun 17, 2011
Posts: 28
posted
0
Yes Paul. I need to upload the pdf or picture through local PC to database..
You'll need a table with a BLOB / binary / varbinary column. You then use PreparedStatement to insert / update a record in that table; PreparedStatement has a few setBinaryStream and setBlob methods and a setBytes method you can use for that.
ruba sampath
Greenhorn
Joined: Jun 17, 2011
Posts: 28
posted
0
Thank you
I have inserted the record in the DB. But before inserting i have to find the file size in JSP using javascript without using ActiveXObject. Please Send me the code ASAP.