This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Struts and the fly likes file upload from action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "file upload from action" Watch "file upload from action" New topic

file upload from action

Nesrin aboud
Ranch Hand

Joined: Feb 08, 2010
Posts: 48
I want to upload a file,
I have the complete path on client side
and the server path also is ready to receive the uploaded file

but I do not know how to user the String path on client side.
I do not want to use the <c:file/> I want to use the path that I have directly

I found a sample of code using the PosMethod
can this work or not inside my Action

and how to set the path of client file into the it

Ankit Garg

Joined: Aug 03, 2008
Posts: 9453

Okay so you want to read a file on client's machine directly from your struts action?? This is not possible, you cannot read any file from the client's hard disk. The only way to do this is the browser sends the file to the server using <input type="file" /> (or <s:file> struts tag)...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
David Newton

Joined: Sep 29, 2008
Posts: 12617

This is basically the same question that was already answered here.
I agree. Here's the link:
subject: file upload from action
It's not a secret anymore!