G
getsanjay.sharma
*** I apologize if this is a duplicate thread since I am having
problems with my ISP***
Hello to all Java programmers out there.
I am currently writing a web application which allows the user to
upload files on the server as their avatar. I am using JBoss 4 as my
application server, Java 1.5, MS Access as my DB (if you would be kind
enough to call it that) and Apache commons FileUpload module.
I have been successful in saving the file to the disk at an absolute
location (c:/photos) but am at a loss on how to save it to my projects
'image' folder i.e. the path relative to my application root
directory. I have a folder 'image' in the application's root directory
but am unable to store the file at that location. I tried various ways
of obtaining the path but to no avail. Also since I am using WAR files
for running project, I have to enter the image in the WAR file but
have no idea on how to do that.
Also I have a host of options when it comes to serving the images back
to the client but I am really confused as to which one is the more
feasible one.
1. I can use the InputStream to the file which the client uploads,
provide it to the setBinaryStream() function of Prepared Statement and
allow it to do its work. But the problem here is that each time the
image has to be displayed, I would have to hit the database and fetch
the image using the byte based approach.
2. I have heard that images / vidoes are BLOBS but I have no idea on
how to insert or retrieve such blob data from the database. Again, I
am sure there would be some kind of overhead involved while fetching
them.
3. I can store the images to a given location on my hard drive (the
problem above) and just provide its path to the src attribute of the
image tag, plain and simple.
I am pretty much confused on how to save the file to the given
location and which alternative to choose.
I would really appreciate if someone would lend me a helping hand in
this situation.
Thanks and regards,
S T S.
problems with my ISP***
Hello to all Java programmers out there.
I am currently writing a web application which allows the user to
upload files on the server as their avatar. I am using JBoss 4 as my
application server, Java 1.5, MS Access as my DB (if you would be kind
enough to call it that) and Apache commons FileUpload module.
I have been successful in saving the file to the disk at an absolute
location (c:/photos) but am at a loss on how to save it to my projects
'image' folder i.e. the path relative to my application root
directory. I have a folder 'image' in the application's root directory
but am unable to store the file at that location. I tried various ways
of obtaining the path but to no avail. Also since I am using WAR files
for running project, I have to enter the image in the WAR file but
have no idea on how to do that.
Also I have a host of options when it comes to serving the images back
to the client but I am really confused as to which one is the more
feasible one.
1. I can use the InputStream to the file which the client uploads,
provide it to the setBinaryStream() function of Prepared Statement and
allow it to do its work. But the problem here is that each time the
image has to be displayed, I would have to hit the database and fetch
the image using the byte based approach.
2. I have heard that images / vidoes are BLOBS but I have no idea on
how to insert or retrieve such blob data from the database. Again, I
am sure there would be some kind of overhead involved while fetching
them.
3. I can store the images to a given location on my hard drive (the
problem above) and just provide its path to the src attribute of the
image tag, plain and simple.
I am pretty much confused on how to save the file to the given
location and which alternative to choose.
I would really appreciate if someone would lend me a helping hand in
this situation.
Thanks and regards,
S T S.