Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.8k views
in Java FTP by (1k points)
hi,

I have an applet for ftp images upload.

run from eclipse IDE (which uses applet viewer) the applet is ok.
if i run my applet from browser here is what happens:
i upload a file .& leave the browser opened.
i then open this same file with gimp or photo-shop & get file in use error.

if i close browser & try opening file .it works ok.

why the file isn't released when applet instance still on browser ?
i 'm sure i close all streams...
the core method i use to upload files is below (client is a FTPClient object)
private synchronized void putFile(File file, String remoteFile)
         throws FileUploadException {
      String sFile = null;
      try {
 
         sFile = r.chomp(remoteFile, '/');
         client.put(file.getAbsolutePath(), sFile + file.getName());
         r.numBytes += file.length();
         
      } catch (Exception e) {
         //e.printStackTrace();
         try {
 
            retry(file, sFile);
         } catch (Exception e1) {
            throw new FileUploadException(e1.getMessage());
 
         }
      }
 
   }


is there a fix to this issue ?

thanks for helping .

1 Answer

0 votes
by (162k points)
Are you opening the file elsewhere in the applet? The FTPClient should close all file handles (take a look at the source if you want to make sure).

Categories

...