Java 将多个文件上载到服务器

Java 将多个文件上载到服务器,java,Java,将多个文件上载到服务器。以下是客户端计算机的代码: void SendFile() throws Exception { String path; System.out.print("Enter File Path :"); path=br.readLine(); File f=new File(path); File files[]=f.listFiles(); String fileName; for(File

将多个文件上载到服务器。以下是客户端计算机的代码:

void SendFile() throws Exception
{        

    String path;
    System.out.print("Enter File Path :");
    path=br.readLine();

    File f=new File(path);
    File files[]=f.listFiles();
    String fileName;

      for(File file:files)
      {
         if(file.isFile())

         {

             fileName=file.getName();
             dout.writeUTF(fileName);


    System.out.println("Sending File ..."+fileName);
    FileInputStream fin=new FileInputStream(f);
    int ch;
    do
    {
        ch=fin.read();
        dout.writeUTF(String.valueOf(ch));
    }
    while(ch!=-1);
    fin.close();
    System.out.println(din.readUTF());

    }  

 }
}
但在发送单个文件后,程序会产生错误:

Exception in thread "main" java.io.FileNotFoundException: /home/bdi-user/Desktop/files (Is a directory)

不要从目录
f
中读取,而是从调用的文件
file
中读取

FileInputStream fin=new FileInputStream(file);

unix区分大小写。。请检查一下文件夹名。。。无论是
文件
还是
文件