Re: Struts & php & file upload

2003-10-23 Thread Martin Cooper

"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]



Re: Struts & php & file upload

2003-10-22 Thread Craig R. McClanahan
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.

* 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]


RE: Struts & php & file upload

2003-10-22 Thread Daniel Washusen
> -Original Message-
> From: Rajat Pandit [mailto:[EMAIL PROTECTED]
> Sent: Thursday, 23 October 2003 1:55 PM
> To: [EMAIL PROTECTED]
> Subject: Struts & php & file upload
>
>
> 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.

not without a lot of stuffing around I would think...

>
> 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.
>

have a look at the struts-upload.war example that comes with the struts
package.

> Thanks in advance
>
>
>
>
> Rajat Pandit | [EMAIL PROTECTED]
> +91 612 3117606
> [ Developer and Part Time Human Being]
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


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



Struts & php & file upload

2003-10-22 Thread Rajat Pandit
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.

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.

Thanks in advance




Rajat Pandit | [EMAIL PROTECTED]
+91 612 3117606
[ Developer and Part Time Human Being]


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