• 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

How to upload a file?

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My website is running on Linux. I want to upload images using java code. Can someone please help me how can I do it? If someone can give me code, I will be thankful to him.

Specially I would like to know:
I have Windows 2000. When I browse the file to upload how does the Linux will read file from this windows path, say D:\images\myimages.jpg and how this image will be uploaded to some folder in my site that's on linux?

Thanks
[ December 14, 2007: Message edited by: Joseph Bashir ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use the Commons HttpClient library on the client, and the Commons FileUpload library in a servlet on the server. An article that describes how to use both is linked in http://faq.javaranch.com/java/FileUpload
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Joseph Bashir:

I have Windows 2000. When I browse the file to upload how does the Linux will read file from this windows path, say D:\images\myimages.jpg and how this image will be uploaded to some folder in my site that's on linux?
[/QB]



Linux doesn't read the file system on your client machine.
Your browser does.

The browser will send the file to the server.
Whatever upload library you use will have a way for you to configure the location for uploaded files. The path information sent with the file (from some browsers) won't affect where the file ends up on your server.
 
get schwifty. tiny 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