works for me...
... i added fixFileName for pesky windows clients
what does your upload form look like?
you may also want to check the write permissions to the directory you are
uploading to. make sure you have write access enabled for the tdk service.
the upload will find the path relative to your webapp.
<tdk_root>/webapps/newapp/upload_images/ in my example.
HTH,
Jeff Painter
public class Upload extends SecureAction
{
public void doUpload(RunData data, Context context)
throws Exception
{
String outFile = "/upload_images/";
FileItem fileItem = data.getParameters().getFileItem("file");
outFile += fixFileName(fileItem.getName());
fileItem.write(TurbineServlet.getRealPath(outFile));
}
public static String fixFileName(String longFile)
{
int loc = longFile.lastIndexOf("\\");
return longFile.substring( (loc+1), longFile.length() );
}
}
On Mon, 10 Feb 2003, George Allaman wrote:
> I am unable to get the file upload service to work using Turbine 2.1 on W2K, either
>in newapp or my application. Is this a known problem (in which case I'm probably
>doing nothing wrong) or not (in which case I am doing something wrong)? My FileItem
>object is always null.
>
> I've spent hours browsing the email list about this, and some people are not able to
>get it to work at all while others seem to be able to. I'm using the code from newapp
>in my app:
>
> public void doUpload(RunData data, Context context)
> throws Exception
> {
> FileItem fileItem = data.getParameters().getFileItem("file");
> fileItem.write(TurbineServlet.getRealPath("/uploaded.file"));
> }
>
> I'm not sure where the uploaded file is supposed to end up, but I've searched my
>entire hard drive for it to no avail. Has anyone had this problem and solved it?
>
> Thanks in advance.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]