Results 1 to 4 of 4

Thread: file transfer

  1. #1
    prashant is offline Member
    Join Date
    Dec 2008
    Posts
    19
    Rep Power
    0

    Question file transfer

    i want to transfer file through socket programming.
    please help me its urgent.

  2. #2
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    10

    Default Google is your friend...

    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  3. #3
    Belete is offline Member
    Join Date
    Dec 2009
    Location
    AddisAbaba
    Posts
    10
    Rep Power
    0

    Default

    Hey guys i was trying to send file to a server from a client and the file will be sent but a serious of small rectangles which are equal to the array length i initialized are also displayed with the file i sent in the server side; what code should i use to avoid this, please can somebody help me out.
    this are the code i used
    Client side
    public void sendFile(){
    try{
    bis = new BufferedInputStream(new FileInputStream(jFileChooser1.getSelectedFile()));
    bos = new BufferedOutputStream(client.getOutputStream( ));
    byteArray = new byte[(int)jFileChooser1.getSelectedFile().length()];
    bis.read(byteArray,0, byteArray.length);
    bos.write(byteArray,0, byteArray.length);
    bis.close();
    bos.close();
    }

    Server side

    public void receiveFile(){

    try{
    byte receivedData[] = new byte[40];
    bis = new BufferedInputStream(socket.getInputStream());
    bis.read(receivedData);
    String st=new String (receivedData,0,receivedData.length);
    System.out.println(st);
    bos = new BufferedOutputStream(new FileOutputStream("belete.txt"));
    bos.write(receivedData);
    bis.close();
    bos.close();
    }

  4. #4
    kibur is offline Member
    Join Date
    Dec 2009
    Posts
    2
    Rep Power
    0

    Default

    Hi, I want to write a system which is used for file hosting system. In the system I WANT TO TRANSFER A FILE FROM CLIENT TO SERVER. so how I can give the specified path in the server and from client side.

Similar Threads

  1. To transfer a file from client to server
    By phani in forum Networking
    Replies: 4
    Last Post: 10-12-2010, 06:15 PM
  2. data loss in the secure file transfer using java
    By antony75 in forum Networking
    Replies: 4
    Last Post: 02-09-2009, 07:56 AM
  3. Applet > servlet file transfer
    By milkman128 in forum Java Applets
    Replies: 1
    Last Post: 11-15-2008, 04:21 PM
  4. Java File Transfer
    By lks0912 in forum Advanced Java
    Replies: 0
    Last Post: 10-23-2008, 12:53 PM
  5. File and Message transfer over sockets!
    By rameshraj in forum Networking
    Replies: 3
    Last Post: 05-14-2008, 08:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •