mirror of
https://github.com/unraid/webgui.git
synced 2026-05-21 05:39:37 -05:00
Merge pull request #829 from Squidly271/patch-25
Only allow png files to be uploaded as user image
This commit is contained in:
@@ -113,7 +113,7 @@ $(function(){
|
||||
url:'/webGui/include/FileUpload.php',
|
||||
data:{path:path,"csrf_token":"<?=$var['csrf_token']?>"},
|
||||
beforeEach:function(file) {
|
||||
if (!file.type.match(/^image\/.*/)) {
|
||||
if (!file.type.match(/^image\/png/)) {
|
||||
swal({title:"Warning",text:"Only PNG images are allowed!",type:"warning",html:true,confirmButtonText:"_(Ok)_"});
|
||||
return false;
|
||||
}
|
||||
@@ -169,7 +169,7 @@ _(Description)_:
|
||||
:user_add_description_help:
|
||||
|
||||
_(Custom image)_:
|
||||
: <span id="dropbox"><?=$void?></span><em>_(Drag-n-drop a PNG file or click the image at the left)_</em><input type="file" id="drop" accept="image/*" style="display:none">
|
||||
: <span id="dropbox"><?=$void?></span><em>_(Drag-n-drop a PNG file or click the image at the left)_</em><input type="file" id="drop" accept="image/png" style="display:none">
|
||||
|
||||
:user_add_custom_image_help:
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ $(function(){
|
||||
url:'/webGui/include/FileUpload.php',
|
||||
data:{"csrf_token":"<?=$var['csrf_token']?>"},
|
||||
beforeEach:function(file) {
|
||||
if (!file.type.match(/^image\/.*/)) {
|
||||
if (!file.type.match(/^image\/png/)) {
|
||||
swal({title:"Warning",text:"_(Only PNG images are allowed)_!",type:"warning",html:true,confirmButtonText:"_(Ok)_"});
|
||||
return false;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ _(Custom image)_:
|
||||
<?else:?>
|
||||
<?=$void?>
|
||||
<?endif;?>
|
||||
</span><em>_(Drag-n-drop a PNG file or click the image at the left)_</em><input type="file" id="drop" accept="image/*" style="display:none">
|
||||
</span><em>_(Drag-n-drop a PNG file or click the image at the left)_</em><input type="file" id="drop" accept="image/png" style="display:none">
|
||||
|
||||
:user_edit_custom_image_help:
|
||||
|
||||
|
||||
@@ -79,6 +79,10 @@ div.case-name{margin-top:8px;font-family:clear-sans!important}
|
||||
<script src="<?autov('/webGui/javascript/dynamix.js')?>"></script>
|
||||
<script>
|
||||
function importFile(file) {
|
||||
if (file.name.split(".").pop().toLowerCase() !== "png") {
|
||||
alert("<?=_("Only png images are allowed!")?>");
|
||||
return;
|
||||
}
|
||||
var reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = function(e){$.post('/webGui/include/SelectCase.php',{mode:'file',file:'<?=$file?>',data:e.target.result,csrf_token:'<?=$_GET['csrf']?>'},function(){top.Shadowbox.close();})};
|
||||
|
||||
Reference in New Issue
Block a user