commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Eugelink <t...@tbee.org>
Subject Re: FileUpoad:
Date Wed, 20 Apr 2005 16:36:41 GMT
> No, don't agree.  Show me the code that you use to farm the data.  I
> assume you are using Commons fileupload.  But, how you do it is what
> makes a difference.  This stuff about the position on the form can be
> discussed later.  No sense letting a great philosophical discussion
> get in the way of getting something done.  ///;-)

Agree.

     	// Check that we have a file upload request
     	if (!FileUpload.isMultipartContent(request))
     	{
			ServletException lServletException = new ServletException("Only file 
uploads are accepted to this URL");
			log4j.error(lServletException);
			throw lServletException;
     	}
     	
     	// Create a new file upload handler
     	DiskFileUpload lFileUpload = new DiskFileUpload();
     	lFileUpload.setSizeThreshold(iMaxSize);
     	lFileUpload.setSizeMax(iMaxSize);
     	lFileUpload.setRepositoryPath(iTmpDir.getAbsolutePath());
     	
     	//
     	// Parse the request
     	List lFileItems = null;
     	try
		{
     		lFileItems = lFileUpload.parseRequest(request);
		}
     	catch (FileUploadException e)
		{
     		response.sendRedirect(iOnError + "?error=parse&info=Bestand is te 
groot");
     		return;
		}

     	//
     	// get the ID
     	FileItem lIdFileItem = getFileItemFromList(lFileItems, "id");


As you can see the sendRedirect occurs before I get the id...

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message