Page 1 of 1

Jspupload directory

Posted: Wed Jun 10, 2009 2:43 pm
by markdm
The readme-file says:
Edit process.jsp from jspupload/ and setup "directory" and "tmpdirectory"
variables with the correct path:
<% String directory = "c:/uploads"; %>
<% String tmpdirectory = "c:/uploads/tmp"; %>
"directory" is the folder where uploaded files will be stored.


Questions:
- is it the directory on the web-server. I suppose I don't have access the c: disk !
- I tried a relative path: /uploads. I get a crashdump on http://yourserver.com/jspupload/process.jsp (replaced yourserver with mydomain)
Start of dump:
org.apache.jasper.JasperException: /process.jsp(12,0) The value for the useBean class attribute jfileupload.jspupload.FileUploadBean is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
...

Can I get some more info on the "Directory" setting ?
Regards,
Mark

Re: JSPUpload directory - getRealPath

Posted: Wed Jun 10, 2009 7:25 pm
by support
Yes, it's the full path to upload folder on your server.
If you don't know how to get it then you can modify the script to use relative path to your web application. To do so, replace:

Code: Select all

<% String directory = "c:/tmp/uploads"; %>
<% String tmpdirectory = "c:/tmp/uploads/tmp"; %>
by:

Code: Select all

<% 
   String rootpath = application.getRealPath("/"); 
   rootpath = rootpath.replace('\\','/');
   if (!rootpath.endsWith("/")) rootpath = rootpath + "/";
%>
<% String directory = rootpath + "uploads"; %>
<% String tmpdirectory = rootpath + "uploads/tmp"; %>
Does it help ?