Widget:File upload: verschil tussen versies
Uit Dorpsbelang Den Hout
Regel 14: | Regel 14: | ||
<div id="widget-file-upload-preview" ></div> | <div id="widget-file-upload-preview" ></div> | ||
− | <label for="widget-file-upload-files" ><!--{if (isset($button) && $button!="")}--><!--{$button}--><!--{else}--><button>Upload</button><!--{/if}--><input type="file" id="widget-file-upload-files" name="files[]" style="display:none" <!--{if (isset($multiple) && $multiple==" | + | <label for="widget-file-upload-files" ><!--{if (isset($button) && $button!="")}--><!--{$button}--><!--{else}--><button>Upload</button><!--{/if}--><input type="file" id="widget-file-upload-files" name="files[]" style="display:none" <!--{if (isset($multiple) && $multiple=="false")}--><!--{else}-->multiple<!--{/if}--> /></label> |
<script> | <script> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
var counter = 0; | var counter = 0; | ||
− | var | + | var settingsPreview = <!--{$preview}-->; |
+ | var settingsCaption = <!--{$caption}-->; | ||
+ | var settingsDrop = <!--{$drop}-->; | ||
+ | var settingsFilepagetemplate = <!--{$filepagetemplate}-->; | ||
+ | var settingsFilepageparameters = <!--{$filepageparameters}-->; | ||
+ | var settingsFilename = <!--{$filename}-->; | ||
− | + | console.log(settingsFilename) | |
function handleFileSelect() { | function handleFileSelect() { | ||
− | + | ||
+ | if(settingsPreview != "false"){ | ||
+ | createPreviews(); | ||
+ | } | ||
} | } | ||
function uploadFiles(evt){ | function uploadFiles(evt){ | ||
− | + | var files = document.getElementById('widget-file-upload-files').files; | |
var proms = []; | var proms = []; | ||
for(i = 0; i < files.length; ++i){ | for(i = 0; i < files.length; ++i){ | ||
Regel 43: | Regel 46: | ||
} | } | ||
Promise.all(proms).then(function(values) { | Promise.all(proms).then(function(values) { | ||
− | + | document.getElementById('form-save').click(); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
}); | }); | ||
− | |||
} | } | ||
Regel 92: | Regel 87: | ||
} | } | ||
− | function | + | |
+ | function createPreviews(){ | ||
var filesSelected = document.getElementById("widget-file-upload-files").files; | var filesSelected = document.getElementById("widget-file-upload-files").files; | ||
if (filesSelected.length > 0) { | if (filesSelected.length > 0) { |
Versie van 7 sep 2020 08:39
This is the Widget:Multi upload page. It should be called in the following format:
{{#widget:Multi upload }}