• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

file uploading basing on a category

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey,

cracking my head to solve this!!! help appreciated

I upload multiple files at a time.
this is the screen written in JSP. say it upload.jsp

File name 1 ___________ browse save
filename 2 ___________ browse save
file name 3 ___________ browse save


there are 6 categories of files in the database..for ex say marketing, distribution, sales, etc..

the add/edit screen lists all the 6 categories and provides a source to upload files.
the screen looks like this

marketing upload
sales upload
dist upload

when the user clicks on upload file corresponding to marketing the jsp window which i gave "upload.jsp" pops up and the user uploads the files and the files are saved in the database.

the corresponding table in d/b: "attachments" ( user_id, file_name, file_category, file_content BLOB, ......)
There is only one common table..we dont want to create a seperate table for each category (strictly)....

So, Along with the file(BLOB) the file_category should be uploaded to the database.


same is the process for all the categories.

the problem: I refered the same "upload.jsp" to all the categories and i am confused in writing the logic for categorizing the files uploaded.


The other problem is, I should list all the files in the specific category(say 'Marketing') when the user clicks the MARKETING tab...other category files should not be displayed. Also ..i should give the count of the files in a specfic category.

Any help is apprecaited.

Thnks
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could just pass the category to the download JSP as a parameter:

download.jsp?category=marketing

The jsp could then preserve the value in a hidden field:

<html-el:hidden property="category" value="${param.category}" />

Then, when the form is submitted you can save it to the database along with the uploaded files.
 
navi kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Merill,

The problem is not when i Upload, in the database table, i have a field holding file category.. so it would not be a problem for that.

But to display the files (BLOBS in the FILE-CONTENT field of the table) basing on the corresponding category.

for ex:
FILE_CATEGORY FILE_CONTENT

marketing xml.pdf
sales good.doc
marketing bad.xls

Now, i need to provide the user(MArketing) with a view containing files belonging to 'marketing' FILE-CATEGORY( xml.pdf, bad.xls)

I m not able to think a sol'n for this!!

Help me out.

regards
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe I'm not understanding the problem here, but this seems fairly simple to me. Just write a query .. select * from uploadedFiles where category = 'Marketing'. Is there a reason a simple query like this won't work?
 
Crusading Chameleon likes the size of this ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic