hi , i m trying to upload any type files to an ftp server through my code
it actually uploads the file but when ever i try to open that file in the server pc only .txt files open up properly and for all the other type of files it says file is either corrupted or damage ...i had also set the file structure to binary file structure
but still this is not happening ...how to correct this can any one tell me ?
i m using apache commons net
Rob Spoor wrote:I can only see two things wrong, and neither of them has anything to do with the upload.
First of all, if you can't create the InputStream you catch an exception but still continue with code that will use the InputStream. That won't work.
Secondly, you're performing a heavy operation (the file upload) on the Event Dispatcher Thread. You should really use a SwingWorker for that.
but this too does not solve my problem now what next ? soory but what ever i have shown you in my earlier code in the same way downloading code is written but it works fine, all files open up nicely including , mp3 , docx , rar , mp4 , ppt , xls , vlc , .txt and so on
but this uploading code only works with .txt but all the other files type like mp3 , vlc show me that some kind of error , or show file is damaged for pics like jpeg , png , docx .. and all
rob i guess this is a bug in apache commons net because this was the bug in apache 3.0 they are claiming that this have been resolved but i guess there are lot of problem similar to this on net forums
please can you try a simple java program for uploading a file to ftp server and please use files like flv , docx , or images
waiting for your reply
if you try it will be help full to both of us thanks for helping