Line 10: Line 10:
 
_input type="file"
 
_input type="file"
  
target* : Name of the File Upload Wiki Page
+
'''target'''* : Name of the File Upload Wiki Page
  
pagecontent : Text content to be added on the File Page
+
'''pagecontent ''': Text content to be added on the File Page
  
force : When an image, force to certain format (png, jpg or gif)
+
'''force ''': When an image, force to certain format (png, jpg or gif)
  
error_id : Id of a DOM Element where error notices will be shown
+
'''error_id ''': Id of a DOM Element where error notices will be shown
  
verbose_id : Id of a DOM element where information about the file is shown
+
'''verbose_id ''': Id of a DOM element where information about the file is shown
  
use_label : Doesn't require a value. When an input field has a label attached to it, then the label will become the upload button and the input field will be hidden
+
'''use_label ''': Doesn't require a value. When an input field has a label attached to it, then the label will become the upload button and the input field will be hidden
  
dropzone : Doesn't require a value. Will turn the verbose div into an additional file drop zone
+
'''dropzone ''': Doesn't require a value. Will turn the verbose div into an additional file drop zone
  
parsecontent: Will force WSForm to first parse the content through the Wiki Parser
+
'''parsecontent''': Will force FlexForm to first parse the content through the Wiki Parser
  
* = a required variable
+
'''*'''= a required variable
 +
 
 +
The '''target''' is basically the name you want to use to store the file or files. It recognizes '''[mwrandom]''', '''[filename]''' and other form fields, by using their name with square brackets around them (see example). '''pagecontent''' can also hold form variables.
  
The target is basically the name you want to use to store the file or files. It recognizes [mwrandon], [filename] and other form fields, by using their name with square brackets around them (see example). pagecontent can also hold form variables.
 
  
  
Line 38: Line 39:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
<_input type="file" target="pictures-[filename]-[mwrandom]" pagecontent="Information of the test file" error_id="div-error" verbose_id="div-verbose" />
 
<_input type="file" target="pictures-[filename]-[mwrandom]" pagecontent="Information of the test file" error_id="div-error" verbose_id="div-verbose" />
 +
 
Example 2
 
Example 2
 +
 
Always make sure an image will be transformed to jpeg.
 
Always make sure an image will be transformed to jpeg.
 +
 
Allow for multiple file upload.
 
Allow for multiple file upload.
 +
 
Add form text field "description" on the files page content.
 
Add form text field "description" on the files page content.
 
<syntaxhighlight lang="html">
 
<syntaxhighlight lang="html">

Revision as of 22:22, 17 February 2022

Name

file

Type

_input

Synopsis

Using file uploads

Description

Use a form to upload one or multiple files.

Parameters

_input type="file"

target* : Name of the File Upload Wiki Page

pagecontent : Text content to be added on the File Page

force : When an image, force to certain format (png, jpg or gif)

error_id : Id of a DOM Element where error notices will be shown

verbose_id : Id of a DOM element where information about the file is shown

use_label : Doesn't require a value. When an input field has a label attached to it, then the label will become the upload button and the input field will be hidden

dropzone : Doesn't require a value. Will turn the verbose div into an additional file drop zone

parsecontent: Will force FlexForm to first parse the content through the Wiki Parser

*= a required variable

The target is basically the name you want to use to store the file or files. It recognizes [mwrandom], [filename] and other form fields, by using their name with square brackets around them (see example). pagecontent can also hold form variables.


Example

This example accepts only a value between 0 and 10 with steps of 0.01 (e.g. 2.21)

Example 1

  <_input type="file" target="pictures-[filename]-[mwrandom]" pagecontent="Information of the test file" error_id="div-error" verbose_id="div-verbose" />

You cannot upload files without adding an unique id.

Example 2

Always make sure an image will be transformed to jpeg.

Allow for multiple file upload.

Add form text field "description" on the files page content.

  <_form action="addToWiki">
  <_input type="file" multiple="multiple" target="pictures-[filename]-[mwrandom]" pagecontent="Information for this image<br>[description]" force="jpg" />
    <_input type="text" name="description" />
    <_input type="submit" value="upload" />
  </_form>

Note

Links

ws-page-props