File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 9463

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!