Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望能再sdk里加上 上传整个文件夹的方法 #55

Open
spean90 opened this issue Nov 3, 2016 · 2 comments
Open

希望能再sdk里加上 上传整个文件夹的方法 #55

spean90 opened this issue Nov 3, 2016 · 2 comments

Comments

@spean90
Copy link

spean90 commented Nov 3, 2016

public void uploadFolder(String key,File file){
	 List<File> files = new LinkedList<File>();
	 listFiles(file, files);
	 int startingPosition = file.getAbsolutePath().length();
	 for (File file2 : files) {
		 putObject(key+file2.getAbsolutePath()
                 .substring(startingPosition)
                 .replaceAll("\\\\", "/"),file2);
	}
	 
}
 private void listFiles(File dir, List<File> results) {
        File[] found = dir.listFiles();
        if ( found != null ) {
            for ( File f : found ) {
                if (f.isDirectory()) {
                	listFiles(f, results);
                } else {
                    results.add(f);
                }
            }
        }
    }
@baiyubin
Copy link
Contributor

感谢您的反馈。目前上不支持,上传文件夹放到SDK里面不合适,一致性无法保证。作为示例放到sample里面。

@ffirewy
Copy link

ffirewy commented Apr 5, 2017

那是否可以理解为 暂不支持批量上传多个文件?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants