Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting path dynamically in oreilly API  RSS feed

 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hell,

The task that I want to acheive is to first get category and then set the path of MultipartRequest according to that category so the whole files should be placed in specific category sub folder.

UploadedFiles
|__Videos
|__Category_Wise
|__(Many Category Folders and each folder have)
|__images
|__videos

I tried a lot but stuck as to how I first get the category and then I set the path. The servlet request.getParameter("file"); is not working and tried arround many things but failed. Finally I did this piece of code but throwing compile time error that "
variable multi might not have not been initialized".


Best regards
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're calling "multi.getParameter" before "multi" has been assigned a value.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:You're calling "multi.getParameter" before "multi" has been assigned a value.


Thanks for your reply but how can I initialize and call?

Best regards
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:You're calling "multi.getParameter" before "multi" has been assigned a value.


How can I tackle this problem?

Please be merciful as my head swollen
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to extract the "(category=multi.getParameter("category"))" part to before the initialization of multi. That does mean that you can't use multi.getParameter since multi isn't declared yet. You are currently trying to get the parameter of something that doesn't exist yet.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:You need to extract the "(category=multi.getParameter("category"))" part to before the initialization of multi. That does mean that you can't use multi.getParameter since multi isn't declared yet. You are currently trying to get the parameter of something that doesn't exist yet.


Yes, of course this is the problem but am looking for the solution.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Finally I found the way to store pictures category wise with the help of following link:
http://www.exampledepot.com/egs/java.io/movefile.html

Thanks all for helping

Best regards
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!