keep folder structure after drag and drop upload in java
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.
精彩评论