Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

uploading images and java

 
Ranch Hand
Posts: 279
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm thinking of starting a new project but I'm unsure whether I should use Java. It's a web application that allows people to build a quiz and I want the user to be able to add questions and images. Can you upload images in Java? Can the program then make use of that image? I figured that because the image isn't already in the jar (and in the right directory) then it can't be used by the program.

I wondered whether I could store any images in a central database and access them this way? is this difficult? Having this data separate in a database might make it easier to produce Android and iphone apps if I went that far (I probably won't). I could write the application in PHP but then I'd lose some functionality.

Any thoughts?

Mike
 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, a web app powered by Java can upload and use images. It has nothing to do with jar files, of which many go into constructing a web app.

See the JSP and servlets FAQs fOr more info.
 
Greenhorn
Posts: 13
Android Hibernate Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its your call to decide which technology you want to use to develop a application, most of the things are supported in most of the technologies.
 
Mich Robinson
Ranch Hand
Posts: 279
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the input guys.

With the jars I have produced so far I can only access images that are in the current jar (ie already zipped up) or in the source directory of the jar. I presume you're saying a java app/applet can input an image and store it in it's home directory so that other users can use it? Can you point me at an example or a slightly longer explanation as to how to do this (or even some keywords I can google ). Cheers.
 
Bear Bibeault
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Web apps are fronted by HTML, usually produced by JSP templates. Images are not read from jar files, but are accessed by <img> elements in the HTML.

Are you sure it's a web app you want to write? It doesn't seem like you've got a good handle on how to approach that.
 
Bear Bibeault
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With regards to file uploading, see the JspFaq and ServletsFaq for starters.
 
Rancher
Posts: 4686
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can do what you are asking, but as @bear asks, are you sure you have thought out the architecture for this?

Concerning storing images on your server, you have many choices. You can simply store the images as files that your webserver (apache, etc.) can read, or you can store the bytes of the image in a blob in your favorite database table in a DBMS (mysql, sqllite, oracle, etc.). Which you select is simply an engineering design question, there are pros and cons of each.
 
Eat that pie! EAT IT! Now read this tiny ad. READ IT!
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic