• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

FTP transaction using a servlet

 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wrote a program that uploads files to a FTP server and then downloads it if necessary later on. The program is working successfully but there is a problem when i download the file. The file is an excel file and when i try to open it the following message is displayed... "The file cannot be accessed. The file may be read only or the server where this file is located is not responding.

Well i have already downloaded the file so the latter part of that sentence does not bear any relevance. I tried to download the file using cute FTP and the download was successfull but yet again i got the same error. So is this something to do with file permissions ? Do i have to change the permissions for that file in the FTP server and then save it ? What is going wrong here ?

I opened the file in notepad and all the data is still there but it just wont let me open the file. HELP !!!


Update: I tried to upload and download the file using cute FTP and it worked. But if i upload with the program and then download it screws up. I am using the FTPClient class and the storeFile and retrieveFile functions in that class. any ideas ?
[ July 03, 2006: Message edited by: John Meyers ]
 
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have not mentioned which OSs you are using. If you are transferring the files between windows and unix like systems, you need to take care to set the mode correctly for binary file (excel file is binary file). By default mode is ascii so you might have to set to binary.

When you use CuteFTP to upload the file, it would upload the excel file in binary mode.

This is the only hint I'm getting eventhough this issue does not strike anything to the error you getting. However you can give this a try.
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried specifically setting the file type to binary but no luck. Its so wierd ! All the data has been downloaded and i can see whatever words i have saved in the xls when i open it with notepad. But for some reason it just wont open up !!! Any other ideas people ? Keep em coming. Thanks
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey it worked !!! guess what i did explicitly mention that the file type was supposed to be binary but... err... i umm forgot to recompile the code after that

Damn ! forgot to check the transfer type in the first place.

Thanks Santhosh
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic