How to upload a directory via Grails or Java ?
Posted
by fabien-barbier
on Stack Overflow
See other posts from Stack Overflow
or by fabien-barbier
Published on 2010-05-24T23:04:53Z
Indexed on
2010/05/24
23:21 UTC
Read the original article
Hit count: 277
What is the best way to upload a directory in grails ?
I try this code :
def upload = {
if(request.method == 'POST') {
Iterator itr = request.getFileNames();
while(itr.hasNext()) {
MultipartFile file = request.getFile(itr.next());
File destination = new File(file.getOriginalFilename())
if (!file.isEmpty()) {
file.transferTo(destination)
// success
}
else
{
// failure
}
}
response.sendError(200,'Done');
}
}
Unfortunately, I can only upload file by file. I would like to define my directory, and upload all files directly.
Any ideas ?
© Stack Overflow or respective owner