cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: [C2] Any Sample for Upload?
Date Thu, 22 Feb 2001 16:07:37 GMT
Davanum Srinivas wrote:
> 
> Berin,
> 
> Was able to upload a file sucessfully. Any ideas on how to display the uploaded images
using
> ImageDirectoryGenerator? Basically how to specify CONTEXT_WORK_DIR/image-dir as the source
for the
> ImageDirectoryGenerator?

Unfortunately no.  It is outside of the context, so it is not accessible
via a sitemap component.

> 
> Thanks,
> dims
> --- Berin Loritsch <bloritsch@apache.org> wrote:
> > Davanum Srinivas wrote:
> > >
> > > Berin,
> > > Do you have any sample for upload?
> >
> > RSN !)
> >
> > If you simply have a form that uses the multipart/form-data
> > encoding type then the MaybeUpload package will parse it,
> > and you can use any of the HttpRequest methods to handle the
> > form--and the files will be uploaded to the CONTEXT_WORK_DIR/image-dir
> > directory--although the files will be silently renamed if there
> > is a name conflict.
> >
> > If you want to get a Handle on the File object uploaded, use
> > the new HttpRequest.get(name) method.  This is an extension
> > of HttpServletRequest, so you must correctly cast your
> > instance to HttpRequest.
> >
> > Enclosed is a snippet of my ImageUploadAction that I am working on:
> >
> > --------------------------------------------------------------------------
> >
> > public Map act(EntityResolver resolver, Map objectModel, String source, Parameters
param) throws
> > Exception {
> >     HttpRequest request = (HttpRequest) objectModel.get(Constants.REQUEST_OBJECT);
> >
> >     // note, some of the details are ommitted, you will not
> >     // be forced to use the name "uploaded-file" in the committed
> >     // version.
> >     File image = (File) request.get("uploaded-file");
> >     int [] dimensions = ImageDirectoryGenerator.getSize(image);
> >     int widthAttr = dimensions[0];
> >     int heightAttr = dimensions[1];
> >     int sizeAttr = (int) image.length();
> > }
> >
> > --------------------------------------------------------------------------
> >
> > >
> > > Thanks,
> > > dims
> > >
> > > --- bloritsch@apache.org wrote:
> > > > bloritsch    01/02/22 06:03:50
> > > >
> > > >   Modified:    src/org/apache/cocoon/environment/http Tag: xml-cocoon2
> > > >                         HttpRequest22.java HttpRequest23.java
> > > >                src/org/apache/cocoon/servlet Tag: xml-cocoon2
> > > >                         CocoonServlet.java
> > > >   Added:       .        Tag: xml-cocoon2 LICENSE.maybeupload
> > > >                lib      Tag: xml-cocoon2 maybeupload.jar
> > > >   Log:
> > > >   Update to allow seamless integration with handling
> > > >   multipart/form-data forms.
> > > >
> > >
> > > =====
> > > Davanum Srinivas, JNI-FAQ Manager
> > > http://www.jGuru.com/faq/JNI
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > > For additional commands, email: cocoon-dev-help@xml.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org
> >
> 
> =====
> Davanum Srinivas, JNI-FAQ Manager
> http://www.jGuru.com/faq/JNI
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org

Mime
View raw message