Changes for page WOFileUpload
Last modified by David Holt on 2012/01/30 22:18
From version 20.1
edited by Pascal Robert
on 2011/04/26 18:47
on 2011/04/26 18:47
Change comment:
There is no comment for this version
To version 16.1
edited by Kieran Kelleher
on 2011/05/06 17:22
on 2011/05/06 17:22
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. probert1 +XWiki.kieran - Content
-
... ... @@ -2,15 +2,24 @@ 2 2 3 3 = Introduction = 4 4 5 -The **WOFileUpload** element allow you to add a <input type=file> HTML element into your form, hence letting your users toupload files to your server. This element must be inside a HTML form ([[WOForm]]) element and the //enctype// binding of the form must be set to "multipart/form-data" (see the examples).5 +The **WOFileUpload** element allows you to add an <input type=file> HTML element into your form, hence letting your users upload files to your server. This element must be inside an HTML form ([[WOForm]]) element and the //enctype// binding of the form must be set to "multipart/form-data" (see the examples). 6 6 7 -Starting with WebObjects 5.2, it 'snowpossible to stream file uploads so that the entire file is not stored in memory on the server while being uploaded.7 +Starting with WebObjects 5.2, it is possible to stream file uploads so that the entire file is not stored in memory on the server while being uploaded. 8 8 9 9 = Usage = 10 10 11 11 {{code}} 12 12 13 -WOFileUpload { filePath=aPath; data=fileData; [inputStream=fileName]; [bufferSize=sizeKB]; [outputStream=fileName]; [streamToFilePath=filePath]; [overwrite=[boolean]]; [finalFilePath=filePath];} 13 +WOFileUpload { 14 + filePath=aPath; 15 + data=fileData; 16 + [inputStream=fileName]; 17 + [bufferSize=sizeKB]; 18 + [outputStream=fileName]; 19 + [streamToFilePath=filePath]; 20 + [overwrite=[boolean]]; 21 + [finalFilePath=filePath]; 22 +} 14 14 15 15 {{/code}} 16 16 ... ... @@ -18,7 +18,7 @@ 18 18 19 19 | filePath | The name of the file being uploaded, including the full path when the client is on Windows. To get only the name of the file without the full path, you can use {{code}}NSPathUtilities.lastPathComponent(filePath){{/code}} 20 20 | data | The file being uploaded will be stored in a [[NSData>>http://www.webobjects.me/API/wo542/com/webobjects/foundation/NSData.html]] object. Please note that the entire file will be in-memory, so beware of out-of-memory errors if users upload large files. 21 -| inputStream | The filewill be streamedto aJavaInputStream object that represents thecontent ofthefile. If you use thatbinding, you can only have one WOFileUpload element in yourpage, and it have to be the last element of thepageand the form's multipleSubmit attribute must be set to false.30 +| inputStream | The binding will be set to an InputStream that points to the file upload. Note that the input stream points directly to the multipart request body part incoming stream and thus you **must** consume this input stream and close it inside the current request action logic. If you use this binding, you can only have one WOFileUpload element in your form, and it have to be the last element of the form and the form's multipleSubmit attribute must be set to false. Our advice, just use streamToFilePath. 22 22 | bufferSize | Sets the size (in bytes) of the buffer used by the outputStream and streamToFilePath attributes. The default buffer size is 512KB. There is no reasonable restriction on the buffer size. 23 23 | outputStream | WebObjects copies the file upload data from the content to the outputStream specified by this attribute. 24 24 | streamToFilePath | WebObjects writes the file upload data from the content directly to the file path specified in this attribute. This is an atomic operation~-~--the data is written to a temporary file, which is renamed when the process is complete. ... ... @@ -46,7 +46,12 @@ 46 46 {{code}} 47 47 48 48 <wo:form enctype = "multipart/form-data"> 49 -<wo:fileUpload streamToFilePath="$streamPathLocation" overwrite="true" filePath="$clientFilePath" finalFilePath="$finalFilePath" /> 58 + 59 + <wo:fileUpload streamToFilePath="$streamPathLocation" 60 + overwrite="true" 61 + filePath="$clientFilePath" 62 + finalFilePath="$finalFilePath" /> 63 + 50 50 </wo:form> 51 51 52 52 {{/code}} ... ... @@ -53,6 +53,8 @@ 53 53 54 54 = Related documents = 55 55 70 +[[ERXWOFileUpload>>http://webobjects.mdimension.com/hudson/job/Wonder/javadoc/er/extensions/components/_private/ERXWOFileUpload.html]] 71 +[[AjaxFileUpload>>http://webobjects.mdimension.com/hudson/job/Wonder/javadoc/er/ajax/AjaxFileUpload.html]] 56 56 [[ERAttachment>>WONDER:ERAttachment Framework]] 57 57 [[Database vs Filesystem>>WO:Development-Database vs Filesystem]] 58 58 [[Localization and Internationalization>>WO:Development-Localization and Internationalization]]