Hi Steph,

thanks for your help! It's working now.

Referring to your note that the maxlength attribute is only for the
filename:

RFC 1867 says:

If the INPUT tag includes the attribute MAXLENGTH, the user agent should
consider its value to represent the maximum Content-Length (in bytes)
which the server will accept for transferred files. 

Cheers,
Lars

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of S. Meslin-Weber
> Sent: 23 January 2006 13:10
> To: RIFE users list : questions, bug reports and suggestions.
> Subject: Re: [Rife-users] How to upload a file with rife?
> 
> 
> Hi Lars,
> 
> On Mon, Jan 23, 2006 at 11:16:45AM +0100, Lars Grupe wrote:
> > <form name="uploadFile" enctype="multipart/form-data" action="[!V 
> > 'SUBMISSION:FORM:uploadFile'/]"
> >     method="post">
> > <!--V 'SUBMISSION:PARAMS:uploadFile'/-->    
> > <input name="file" type="file" size="50" maxlength="100000" 
> > accept="text/*"> <!--V 'fileUploadButton'/-->
> > </form>
> 
> Not really a bug, but the maxlength attribute here is for the 
> maximum length of the filename text field - not the uploaded 
> file size, so 100k is perhaps overkill :). If you do want to 
> limit file upload sizes, this can be set in your 
> rep/config-base.xml file with the following (more parameters 
> are available, please see the link to the LiveGuide further down),
> 
> <param name="FILEUPLOAD_SIZE_LIMIT"> (value in bytes) </param>
> 
> Also note that according to various references on the web, 
> current browsers ignore the "accept" attribute (it's only 
> intended to filter the file selection dialog on the client anyway).
> 
> I'm assuming that you've got a <!--BV 'fileUploadButton'--> 
> elsewhere in your template to add the submit button :)
> 
> > My submission looks like the following:
> > 
> > <submission name="uploadFile">
> >     <param name="file"/>
> > </submission>
> 
> Ah, there's the problem - you're saying that a parameter 
> called file will be used rather than saying a file will 
> arrive... Checking over the DTD declaration for <submission> 
> and it takes (param | bean | file). So if we re-write your 
> submission snippet like this:
> 
> <submission name="uploadFile">
>   <file name="file"/>
> </submission>
> 
> The rest of your code will work.
>       
> > And I thought, that I can get the file with the following code that 
> > handles the submission:
> > 
> > public void doUploadFile()
> > {
> >     UploadedFile uploadedFile = getUploadedFile("file");
> >     logger.debug("UploadedFile: " + uploadedFile.getName()); }
> 
> [snippet error messages]
> > Must I define a bean with a constraint .file(true)?
> > I couldn't find much about it in the documenation.
> 
> No, using beans for file upload isn't required; and you're 
> absolutely right, documentation for such a simple file upload 
> was indeed missing.
> 
> I've added a section to the RIFE LiveGuide to address this, 
> feel free to amend it if needed:
> 
http://rifers.org/wiki/display/RIFE/GuideCookbook#GuideCookbook-sectcook
bookfileupload

Please let us know how you get on, and thanks for using RIFE!

Steph

-- 
================================================================
Stephane Meslin-Weber         Email: [EMAIL PROTECTED]
Senior Software Engineer      Web: http://odonata.tangency.co.uk
================================================================
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to