No edit summary |
|||
(7 intermediate revisions by 5 users 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=" | <input type="file" id="fileUpload" name="test" target="pictures-[filename]-[mwrandom]" pagecontent="Information of the test file" error_id="div-error" verbose_id="div-verbose" /> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 13: | Line 13: | ||
<syntaxhighlight lang="html"> | <syntaxhighlight lang="html"> | ||
<form enctype="multipart/form-data" > | <form enctype="multipart/form-data" > | ||
<input type="file" id=" | <input type="file" id="fileUpload" name="myfile" multiple="multiple" parsecontent target="pictures-[filename]-[mwrandom]" pagecontent="Information for this image: [description]" force="jpg" /> | ||
<input type="text" name="description" /> | <input type="text" name="description" /> | ||
<input type="submit" value="upload" /> | <input type="submit" value="upload" /> | ||
Line 22: | Line 22: | ||
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 enctype="multipart/form-data" > | <form enctype="multipart/form-data" > | ||
<input type="file" id=" | <input type="file" id="fileUpload" name="myfile" 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="text" name="Comment" placeholder="Comment" /> | ||
<input type="submit" value="upload" /> | <input type="submit" value="upload" /> | ||
Line 33: | Line 33: | ||
<syntaxhighlight lang="html"> | <syntaxhighlight lang="html"> | ||
<form enctype="multipart/form-data" messageonsuccess="File has been converted and uploaded"> | <form enctype="multipart/form-data" messageonsuccess="File has been converted and uploaded"> | ||
<input type="file" name="myfile" id=" | <input type="file" name="myfile" id="fileUpload" multiple="multiple" parsecontent target="[filename]" pagecontent="This image belongs to : [filename]" action="convertfrom:docx" comment="converted and uploaded from {{PAGENAME}}" /> | ||
<input type="submit" value="upload" /> | <input type="submit" value="upload" /> | ||
</form> | </form> | ||
</syntaxhighlight> | |||
==== Example 5 ==== | |||
Convert a Microsoft Excel document to a page in the Wiki. The Excel content (from the second sheet) is stored in json format in a slot and a create is used to also store a template in the main slot. | |||
<syntaxhighlight lang="html"> | |||
<form enctype="multipart/form-data" messageonsuccess="File has been converted and uploaded"> | |||
<div class="form-group"> | |||
<fieldset class="form-group"><legend>Upload and convert Excel to Json</legend> | |||
<_create noseo mwwrite="[FFUploadedFile-NewName-myfile]" mwtemplate="Test excel convert" mwfields="FFUploadedFile-UploadName-myfile::Original filename" /> | |||
<input type="file" class="form-control-file" id="testingFile" name="myfile" sheet_by_id="1" parsecontent target="[filename]" action="convertfrom:xlsx" slot="ws-data" comment="converted and uploaded from {{PAGENAME}}" accept=".xlsx" target="excel-data-[mwrandom]-[filename]" /> | |||
<input type="submit" value="upload" /> | |||
</fieldset> | |||
</div> | |||
</form> | |||
</syntaxhighlight> | </syntaxhighlight> | ||
ws-class-props | |||
---|---|---|---|
Line 1: | Line 1: | ||
{{ | {{Csp class properties | ||
|Subject version=2.1 | |Subject version=2.1,2.5 | ||
|Doc subject=DevOps:Doc/FlexForm | |Doc subject=DevOps:Doc/FlexForm | ||
|Doc parent=DevOps:Doc/FlexForm/2.1/input/file | |Doc parent=DevOps:Doc/FlexForm/2.1/input/file |
Latest revision as of 09:58, 26 August 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="fileUpload" name="test" 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 enctype="multipart/form-data" >
<input type="file" id="fileUpload" name="myfile" 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 enctype="multipart/form-data" >
<input type="file" id="fileUpload" name="myfile" 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>
Example 4
Convert a Microsoft Docx document to a page in the Wiki. In our example the pagename will be the filename.
<form enctype="multipart/form-data" messageonsuccess="File has been converted and uploaded">
<input type="file" name="myfile" id="fileUpload" multiple="multiple" parsecontent target="[filename]" pagecontent="This image belongs to : [filename]" action="convertfrom:docx" comment="converted and uploaded from {{PAGENAME}}" />
<input type="submit" value="upload" />
</form>
Example 5
Convert a Microsoft Excel document to a page in the Wiki. The Excel content (from the second sheet) is stored in json format in a slot and a create is used to also store a template in the main slot.
<form enctype="multipart/form-data" messageonsuccess="File has been converted and uploaded">
<div class="form-group">
<fieldset class="form-group"><legend>Upload and convert Excel to Json</legend>
<_create noseo mwwrite="[FFUploadedFile-NewName-myfile]" mwtemplate="Test excel convert" mwfields="FFUploadedFile-UploadName-myfile::Original filename" />
<input type="file" class="form-control-file" id="testingFile" name="myfile" sheet_by_id="1" parsecontent target="[filename]" action="convertfrom:xlsx" slot="ws-data" comment="converted and uploaded from {{PAGENAME}}" accept=".xlsx" target="excel-data-[mwrandom]-[filename]" />
<input type="submit" value="upload" />
</fieldset>
</div>
</form>