开发者

keep folder structure after drag and drop upload in java

开发者 https://www.devze.com 2023-03-03 02:05 出处:网络
i ve written a drag and drop applet that uploads files to an ftp server, problem is, the directory tree is lost after the upload, is there a way to keep the tree structure of the folder that is upload

i ve written a drag and drop applet that uploads files to an ftp server, problem is, the directory tree is lost after the upload, is there a way to keep the tree structure of the folder that is uploaded and recreate this structure on the ftp site, eg. c:\temp\new on local becomes \www\uploads\temp\new on the ftp server thanks

below is a sample of the method resposible for the upload

public void showDir(File开发者_开发百科 file) throws IOException {
     uploadClass sender = new uploadClass();
     text.append( file.getCanonicalPath() + "\n" );
     try { 
          ender.uploadFunction(file.getCanonicalPath());
     } catch {...}


Assuming you are traversing the directory tree that was dragged/dropped and uploading (put or mput ftp commands) all the files in each subdirectory, you must issue the ftp mkdir and cd commands to the remote system.

ftp doesn't do sub-trees automatically.

0

精彩评论

暂无评论...
验证码 换一张
取 消