(Imported by PageSync) Tag: wsps-content-edit-tag |
|||
| (4 intermediate revisions by one other user not shown) | |||
| Line 2: | Line 2: | ||
This will upload a file. If the filename is DCM10001.jpg, the file will be uploaded as '''pictures-DCM10001-732138982.jpg''', The filepage will have '''Information of the test file'''. Finally using '''error_id''' and '''verbose_id''', means the user should add two div's, one with an id="div-error" and one with an id="div-verbose" with these name themselves. | This will upload a file. If the filename is DCM10001.jpg, the file will be uploaded as '''pictures-DCM10001-732138982.jpg''', The filepage will have '''Information of the test file'''. Finally using '''error_id''' and '''verbose_id''', means the user should add two div's, one with an id="div-error" and one with an id="div-verbose" with these name themselves. | ||
<syntaxhighlight lang="html"> | <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> | </syntaxhighlight> | ||
| Line 12: | Line 12: | ||
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"> | ||
< | <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> | </syntaxhighlight> | ||
==== Example 3 ==== | ==== 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"> | 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" > | ||
< | <input type="file" id="file-upload" target="picture-[mwrandom]" parsecontent template="Uploaded file" pagecontent="[flexform-template]|Uploaded from page={{FULLPAGENAME}}|Uploaded by={{CURRENTLOGGEDUSER}}|Comment=[Comment][/flexform-template]" | ||
< | <input type="text" name="Comment" placeholder="Comment" /> | ||
< | <input type="submit" value="upload" /> | ||
</ | </form> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| ws-class-props | |||
|---|---|---|---|
| Line 1: | Line 1: | ||
{{ | {{Csp class properties | ||
|Subject version=2.0 | |Subject version=2.0 | ||
|Doc subject=DevOps:Doc/FlexForm | |Doc subject=DevOps:Doc/FlexForm | ||
|Doc parent=DevOps:Doc/FlexForm/ | |Doc parent=DevOps:Doc/FlexForm/2.0/input/file | ||
|Doc sort order=10 | |Doc sort order=10 | ||
|Doc target group=User | |Doc target group=User | ||
|Doc synopsis=Examples on using file uploads | |||
}} | }} | ||
Latest revision as of 09:33, 15 July 2025
Example 1
This will upload a file. If the filename is DCM10001.jpg, the file will be uploaded as pictures-DCM10001-732138982.jpg, The filepage will have Information of the test file. Finally using error_id and verbose_id, means the user should add two div's, one with an id="div-error" and one with an id="div-verbose" with these name themselves.
<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" >
<input type="file" id="file-upload" target="picture-[mwrandom]" parsecontent template="Uploaded file" pagecontent="[flexform-template]|Uploaded from page={{FULLPAGENAME}}|Uploaded by={{CURRENTLOGGEDUSER}}|Comment=[Comment][/flexform-template]"
<input type="text" name="Comment" placeholder="Comment" />
<input type="submit" value="upload" />
</form>