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

File Upload Error - Using JSCH/SFTP

 
Dibyendu Sarkar
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using JSCH APIsto upload files to a remote SFTP server. Till now I was running Tomcat on my local system and testing the code so everything was working fine. I could upload the files from the local system to the Remote SFTP location.

Now that the code was deployed to the testing environments, I started getting the following exception:

java.io.FileNotFoundException: C:\Documents and Settings\User001\Desktop\Testing.txt (No such file or directory)


On printing the canonical path of the file, I found that the filename string that I was passing to the code, was getting the Server's Tomcat Bin directory appended to it!! So the file not found error.

Can anybody tell me please how to make the server look into the client machine's file structure, instead of the server?

Here's the Code to upload:




I'm thinking whatever the cause is, it will make my "Download Attachment" method to fail too, as it will download to the server instead of the client machine.

Note: This code works fine on localhost. So I'm assuming logic and usage of the API is fine.
Thanks,
Dibyendu
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic