Line 1: | Line 1: | ||
+ | ==== Example 1 ==== | ||
+ | <syntaxhighlight lang="html"> | ||
+ | <_input type="file" id="file-upload" target="pictures-[filename]-[mwrandom]" pagecontent="Information of the test file" error_id="div-error" verbose_id="div-verbose" /> | ||
+ | </syntaxhighlight> | ||
+ | ==== 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. | ||
+ | <syntaxhighlight lang="html"> | ||
+ | <_form action="addToWiki" enctype="multipart/form-data" > | ||
+ | <_input type="file" id="file-upload" multiple="multiple" parsecontent target="pictures-[filename]-[mwrandom]" pagecontent="Information for this image: [description]" force="jpg" /> | ||
+ | <_input type="text" name="description" /> | ||
+ | <_input type="submit" value="upload" /> | ||
+ | </_form> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ==== Example 3 ==== | ||
+ | Store a template to the pagecontent. You can use this if you want the filepage to have structured content or if you want to store structured data with an extension like SMW.<syntaxhighlight lang="html"> | ||
+ | <_form action="addToWiki" enctype="multipart/form-data" > | ||
+ | {{#tag:_input ||type=file |id=file-upload |target=picture-[mwrandom] |parsecontent=true |pagecontent=<nowiki>{{Uploaded file | ||
+ | |Uploaded from page=</nowiki>{{FULLPAGENAME}}<nowiki> | ||
+ | |Uploaded by=</nowiki>{{CURRENTLOGGEDUSER}}<nowiki> | ||
+ | |Comment=[Comment] | ||
+ | }}</nowiki> | ||
+ | }} | ||
+ | <_input type="text" name="Comment" placeholder="Comment" /> | ||
+ | <_input type="submit" value="upload" /> | ||
+ | </_form> | ||
+ | |||
+ | </syntaxhighlight> |
Revision as of 19:49, 9 September 2022
Example 1
<_input type="file" id="file-upload" target="pictures-[filename]-[mwrandom]" pagecontent="Information of the test file" error_id="div-error" verbose_id="div-verbose" />
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" enctype="multipart/form-data" >
<_input type="file" id="file-upload" multiple="multiple" parsecontent target="pictures-[filename]-[mwrandom]" pagecontent="Information for this image: [description]" force="jpg" />
<_input type="text" name="description" />
<_input type="submit" value="upload" />
</_form>
Example 3
Store a template to the pagecontent. You can use this if you want the filepage to have structured content or if you want to store structured data with an extension like SMW.
<_form action="addToWiki" enctype="multipart/form-data" >
{{#tag:_input ||type=file |id=file-upload |target=picture-[mwrandom] |parsecontent=true |pagecontent=<nowiki>{{Uploaded file
|Uploaded from page=</nowiki>{{FULLPAGENAME}}<nowiki>
|Uploaded by=</nowiki>{{CURRENTLOGGEDUSER}}<nowiki>
|Comment=[Comment]
}}</nowiki>
}}
<_input type="text" name="Comment" placeholder="Comment" />
<_input type="submit" value="upload" />
</_form>