File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

send file from client to server using serialization

 
Nitesh Pandey
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey...i want to write a program to send file from client to server using serialization...bt i am facing problem when client send the file to server it does not send the file with content...what would be problem..please help me regarding this my client code is:::



 
Greg Charles
Sheriff
Posts: 2984
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nitesh,

Welcome to Java Ranch! I just have a couple of administrative points to get you started. First, when asking a new question, it's best to start it in a new thread. I've split this one off for you. Also, when posting code, it's good to use code tags. Just press the Code button above the edit window, and then past in your code between the tags it generates. It will make your code much easier for us to read.

Now, I think your problem is that serializing the File object is not the same as writing the contents of the file. I assume you have a Server class running on the server or nothing would work at all, so you just have to change the part where you serialize via writeObject() and readObject() to reading the file contents and writing them to the the socket on the server, and reading from the socket and writing to a file on the client. Look into the classes java.io.FileInputStream and java.io.FileOutputStream to get started.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic