DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Java (http://www.daniweb.com/forums/forum9.html)
-   -   beginner question <<save an image in a folder>> (http://www.daniweb.com/forums/thread195904.html)

localp Jun 5th, 2009 2:59 am
beginner question <<save an image in a folder>>
 
I am an absolute beginner in JAVA, i want to know how to upload and save an image in a prescribed folder. sorry, i tried my best to search for this in the net, but i couldn't find any related to this, and also i do not have any sample code. if some one has done a similar task please help me.

i use JBuilder to Build my application..

Please help me i am completely lost in java

Sai_Vargheese Jun 5th, 2009 4:24 am
Re: beginner question <<save an image in a folder>>
 
Hi,
For writing a file this is the code snippet
try {
BufferedWriter out = new BufferedWriter(new FileWriter("outfilename"));
out.write(char[] cbuf, int off, int len);
out.close();
} catch (IOException e) {
}
http://www.exampledepot.com/egs/java...iteToFile.html

Now what do you mean by upload? Is this a client-server setup?
In that case is client/server on JAVA platform, upload is used in HTTP perspective. Please eloborate your requirements.

localp Jun 5th, 2009 9:07 am
Re: beginner question <<save an image in a folder>>
 
Quote:

Originally Posted by Sai_Vargheese (Post 884124)
Hi,
For writing a file this is the code snippet
try {
BufferedWriter out = new BufferedWriter(new FileWriter("outfilename"));
out.write(char[] cbuf, int off, int len);
out.close();
} catch (IOException e) {
}
http://www.exampledepot.com/egs/java...iteToFile.html

Now what do you mean by upload? Is this a client-server setup?
In that case is client/server on JAVA platform, upload is used in HTTP perspective. Please eloborate your requirements.


there will be a button call browse when the user clicks on it he will be able to browse through the file system and select a file to upload or save on apache server with is installed on the same PC.

I simply want to Upload an image which is saved on your file system and save it on another location (like in CGI-BIN in apache server)

peter_budo Jun 5th, 2009 9:35 am
Re: beginner question <<save an image in a folder>>
 
For pc to server upload you better to use something like Commons FileUpload


All times are GMT -4. The time now is 5:13 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC