Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 15740 invoked from network); 5 Apr 2004 06:36:59 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 5 Apr 2004 06:36:59 -0000 Received: (qmail 16569 invoked by uid 500); 5 Apr 2004 06:36:32 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 16266 invoked by uid 500); 5 Apr 2004 06:36:30 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 16250 invoked from network); 5 Apr 2004 06:36:30 -0000 Received: from unknown (HELO imo-d03.mx.aol.com) (205.188.157.35) by daedalus.apache.org with SMTP; 5 Apr 2004 06:36:30 -0000 Received: from Artstar910@aol.com by imo-d03.mx.aol.com (mail_out_v37_r1.2.) id t.6d.26124da0 (3972) for ; Mon, 5 Apr 2004 02:36:39 -0400 (EDT) From: Artstar910@aol.com Message-ID: <6d.26124da0.2da25877@aol.com> Date: Mon, 5 Apr 2004 02:36:39 EDT Subject: Newbie Commons Upload Servlet Won't Compile To: commons-user@jakarta.apache.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="part1_6d.26124da0.2da25877_boundary" X-Mailer: 8.0 for Windows sub 6800 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --part1_6d.26124da0.2da25877_boundary Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable Subj: Newbie Commons Upload Servlet Won't Compile=A0 =20 Date: 4/4/2004 5:35:13 PM Pacific Daylight Time =20 From: Artstar910 =20 To: commons-dev@jakarta.apache.org =20 =20 Here is my code please help figure out what is wrong... ----------------------------------------------------------------------------= -- ------------------------- import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; import org.apache.commons.fileupload.*; public class fileuploadcommon extends HttpServlet {=20 =A0=A0=A0 public void doPost(HttpServletRequest req,=20 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 HttpServl= etResponse res) =A0=A0=A0=A0=A0=A0 throws ServletException, IOException =A0=A0=A0 { =A0=A0=A0=A0=A0=A0=A0 DiskFileUpload fu =3D new DiskFileUpload(); =A0=A0=A0=A0=A0=A0=A0 // maximum size before a FileUploadException will be t= hrown =A0=A0=A0=A0=A0=A0=A0 fu.setSizeMax(1000000); =A0=A0=A0=A0=A0=A0=A0 // maximum size that will be stored in memory =A0=A0=A0=A0=A0=A0=A0 fu.setSizeThreshold(4096); =A0=A0=A0=A0=A0=A0=A0 // the location for saving data that is larger than=20 getSizeThreshold() =A0=A0=A0=A0=A0=A0=A0 fu.setRepositoryPath("/tmp"); =A0=A0=A0=A0=A0=A0=A0 List fileItems =3D fu.parseRequest(req); =A0=A0=A0=A0=A0=A0=A0 // assume we know there are two files. The first file=20= is a small =A0=A0=A0=A0=A0=A0=A0 // text file, the second is unknown and is written to=20= a file on =A0=A0=A0=A0=A0=A0=A0 // the server =A0=A0=A0=A0=A0=A0=A0 Iterator i =3D fileItems.iterator(); =A0=A0=A0=A0=A0=A0=A0 String comment =3D ((FileItem)i.next()).getString(); =A0=A0=A0=A0=A0=A0=A0 FileItem fi =3D (FileItem)i.next(); =A0=A0=A0=A0=A0=A0=A0 // filename on the client =A0=A0=A0=A0=A0=A0=A0 String fileName =3D fi.getName(); =A0=A0=A0=A0=A0=A0=A0 // save comment and filename to database =A0=A0=A0=A0=A0=A0=A0 // write the file =A0=A0=A0=A0=A0=A0=A0 fi.write("/uploads/" + fileName); =A0=A0=A0 } } ----------------------------------------------------------------------------= -- ------------------------- Here is the error that I get... ----------------------------------------------------------------------------= -- ------------------------- fileuploadcommon.java:47: write(java.io.File) in=20 org.apache.commons.fileupload.FileItem=20 cannot be applied to (java.lang.String) =A0=A0=A0=A0=A0=A0=A0=20 fi.write("/uploads/" + fileName); ^ 1 error ----------------------------------------------------------------------------= -- ------------------------- I can't figure out what this means. If anyone knows what this error is cause= =20 by please post. Thank you, Matt Newman --part1_6d.26124da0.2da25877_boundary--