You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Juan Fu <JF...@ncilp.com> on 2003/05/20 00:03:25 UTC
upload directory
HI,
I have problem with upload directory. I bought "Struts: kick start".
There is a sample for uploading file. This is part of the source code:
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
PageHelperBean pageBean = new PageHelperBean();
PageAddForm hff = (PageAddForm) form;
// org.apache.struts.upload.FormFile contains the uploaded file
FormFile file = hff.getFile();
// If no file was uploaded (e.g. first form load), then display View
String dir=null;
String fname=null;
String size=null;
if (file != null )
{
// upload file
MessageResources messages = getResources(request);
System.out.println("message: " +messages);
dir = messages.getMessage("save.dir");
// Get the name and file size
fname = file.getFileName();
System.out.println("filename: " +fname);
size = Integer.toString(file.getFileSize()) + " bytes";
}
I want to know how to code the upload dirctory. I know "save.dir" is for the
upload directory, but what is its real format? Suppose, my jsp file is under
public-html/file1, my upload file is in public-html/docs, then how should I
code in the action class?
I need your help. Thank you.
Ms. Juan Fu
(281)897-7980(O)
IT/Fall Brook
NCI Building System, Inc.
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org