• 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

Uploading a file from Windows to Tomcat deployed on Linux

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to upload the file from local system to the tomcat server installed  on linux. In local tomcat it is able to upload the file and see the complete file path in logs from location i am uploading.
When i am trying to upload the file to  tomcat on linux server.It does't give me complete file path in logs.it just show name of file.





In local Tomcat it return :C:\folder1\folder2\filename



In remote  it return :filename


Please help me this is very urgent
 
Saloon Keeper
Posts: 7582
176
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You mean the file path where the file was stored locally before the upload? You can't rely on that being available for security reasons.
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tim is right, you should assume that there is no path, and only use the file name.

Also, can you please ease up? We're all volunteers here.
 
sat kadam
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks!

 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tomcat is a web server, not a file server. Tomcat cannot upload files, nor can remote users access the filesystem of the Tomcat server (which would be a major security problem).

Instead, the HTTP/HTML protocols support something called multipart MIME* format, which allows different data items to be combined into a single HTTP text request, sent to the server.

In other words, you don't "upload", your client opens the file on your local system, packs it into an HTTP POST in MIME format, and sends the POST to the server, where the server-side code unpacks and decodes the request. The "file" isn't loaded, but what comes in is a copy of the data that was in the file.

Along with the data that comes in is also meta-data, including the "filename". In some versions of Internet Explorer (and possibily some non-Microsoft web browsers), this was the full client-side filesystem path. This is actually a security risk, since it tells the server things it shouldn't know about the organization of the client's computer. Most clients set the value of "filename" to the simple filename (including extensions, if present), without the directory path.

The population of the "filename" is entirely the work of the client, so Tomcat has no control over it.

Finally, the data that is uploaded to Tomcat may or may not be actually stored in a file on the Tomcat server. JEE doesn't require a particular media or location for uploaded "files", just that the API that accesses the file data should be able to retrieve a copy of that data. The data that was uploaded may be in an anonymous temporary file, it might simply be kept in RAM, if it's small enough, or for that matter it could theoretically be kept in a database or other storage media

---
* Originally designed for Multimedia Internet Mail Extensions, which is why it's called MIME.
 
Aaaaaand ... we're on the march. Stylin. Get with it 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