This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Uploading a file from Windows to Tomcat deployed on Linux  RSS feed

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • 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: 5406
143
Android Firefox Browser Mac OS X Safari Tomcat Server VI Editor
  • Likes 2
  • Mark post as helpful
  • send pies
  • 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: 21719
102
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks!

 
Saloon Keeper
Posts: 20649
122
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • 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.
 
I have a knack for fixing things like this ... um ... sorry ... here is a consilitory tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!