spring-guides / gs-uploading-files

Uploading Files :: Learn how to build a Spring application that accepts multi-part file uploads.

Home Page:http://spring.io/guides/gs/uploading-files/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using initial source for FileSystemStorageService fails testing when creating multi-directory

aalmero-zz opened this issue · comments

Using initial source for gs-uploading-files/initial/src/main/java/hello/storage/FileSystemStorageService.java fails testing when creating multi-directory. e.g. /file/foo

@Override
public void init() {
  try {
    Files.createDirectory(rootLocation);
  } catch {IOException e) {
    throw new StorageException("Could not initialize storage", e);
  }
}

May need to be updated with final source.

@Override
    public void init() {
        try {
            Files.createDirectories(rootLocation);
        }
        catch (IOException e) {
            throw new StorageException("Could not initialize storage", e);
        }
}

This guide is meant to be a simple example. Adding multiple directories is more complexity than we want in a 15-minute sample.