Jspupload directory

All others add-ons (Secure FTP, SCP, Flickr, scripts ...).
Post Reply
markdm
Posts: 1
Joined: Wed Jun 10, 2009 2:33 pm

Jspupload directory

Post 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

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: JSPUpload directory - getRealPath

Post 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 ?

Post Reply