Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Upload using MultipartRequest...

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am able to upload to the root directory, but when i specify subdirectory, i get an error saying invalid directory.
This is what i am doing
MultipartRequest multi = new MultipartRequest(req, ".\\myserver\\public_html", 1024*1024);
The following works fine.
MultipartRequest multi =
new MultipartRequest(req, ".", 1024*1024);
Also is there way that i can get the filename first even before i do the actual upload as i want to check for the type of file, want to limit for just 3 type of files(.txt, .doc, .html). And also is there a way that i can do the virus check before its actually uploaded.
Could anyone please let me know.
Thanks,
Appreciate your help and anticipating for your reply!
 
Mandy Smith
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can upload to any subdirectory in my server.
I had specified a directory which was not existing, but this works fine now.
MultipartRequest multi = new MultipartRequest(req, ".\\myserver\\public_html", 1024*1024);
I have another problem how to specify the user when the user's file exceeds max size set, it will just throw a IOException if size is greater than the specified size. How to let the user know of this? Also how to do the virus scan?
Thanks,
Appreciate your help!
 
reply
    Bookmark Topic Watch Topic
  • New Topic