"Craig R. McClanahan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Rajat Pandit wrote:
>
> >Hello,
> >I had this thought this morning, please excuse me if it seems rather
> >silly. But I was wondering if there is a possibility for accessing the
> >information put in the session or request scope by the servlet via php.
> >I came up with this idea when I had to learn how the http upload thing
> >works.
> >
> >
> Interesting timing that you should mention that.
>
> There is a relatively new JSR (JSR-223) that is focused on defining
> standard interfaces between the J2EE paltform and scripting languages,
> including (but not limited to) PHP.  Among other things, they are
> looking at making it possible to share session-scoped information
> between the two languages.  I can by no means guarantee that such
> functionality will be included in whatever JSR-223 results in, but at
> least it's being looked at.
>
> >Second part: cant someone give me  a quick example (descriptive) of how
> >to upload a file and move it to a particular place on the server.
> >
> >
> >
> The simplest way to approach this is to consider it as two separate
> problems:
>
> * How do I get the file uploaded to the server?  The standard
> commons-fileupload
>   funcationality takes care of that, and should be sufficient as long as
> the uploaded
>   file fits in memory.  If it doesn't, you'll want to look at the
> Javadocs for commons-fileupload
>   to determine how to write the uploaded data to a disk file on the
> server instead.

Actually, the the file will only be kept in memory if its size falls below a
configurable threshold. If it's larger than that, it will be written to a
temporary file on disk. The threshold is configured using the 'memFileSize'
attribute on the 'controller' element in your Struts config file; the
default is 256KB.

--
Martin Cooper


>
> * How do I "move" the data to a particular place on the server?  If
> you've got the uploaded
>   data in memory, this seems like a pretty simple task ... open an
> output file and write the
>   uploaded bytes to it.  If you stored the uploaded data into a disk
> file instead, then it's
>   probably either using the rename() method of the java.io.File class,
> or a 20-line method to
>   copy the data from one file to another -- and any basic Java tutorial
> on file I/O should be
>   able to help you there.
>
> Craig




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to