This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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 ]
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.
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