Hello any one tell me how do i create the program for upload to server.
plz any give some idea abt that

which commend is ur for uploading file to server in which way can i handle that

I myself is working on an applet which users can use to upload files to a ftp. The file can be loaded from local machine or it can be remote url.

You can try the below code.

//Add the file to read
File file = null;

//Add the file to write
File file1 = null;

FileInputStream fileinputstream = null;
BufferedInputStream bufferedinputstream = null;
FileOutputStream fileoutputstream = null;
BufferedOutputStream bufferedoutputstream = null;
try
{
    bufferedinputstream = new BufferedInputStream(fileinputstream = new FileInputStream(file));
    bufferedoutputstream = new BufferedOutputStream(fileoutputstream = new FileOutputStream(file1));
    byte abyte0[] = new byte[8192];
    int i;
    while((i = bufferedinputstream.read(abyte0)) != -1) 
	bufferedoutputstream.write(abyte0, 0, i);
}
finally
{
    try
    {
	bufferedinputstream.close();
    }
    catch(Exception exception1) { }
    try
    {
	fileinputstream.close();
    }
    catch(Exception exception2) { }
    try
    {
	bufferedoutputstream.close();
    }
    catch(Exception exception3) { }
    try
    {
	fileoutputstream.close();
    }
    catch(Exception exception4) { }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.