当前位置:网站首页>PHP does not allow images to be uploaded together with data (no longer uploading images before uploading data)
PHP does not allow images to be uploaded together with data (no longer uploading images before uploading data)
2022-06-26 09:23:00 【Baldness due to naming】
Use jq Realization function
html Make a button style you like , And make one input file As the upload object
Bloggers use layui Upload button style Give buttons and input Add the last id
<div class="layui-input-block">
<button type="button" class="layui-btn layui-btn-primary" id="sys_logo">
<i class="layui-icon"></i> To upload pictures
</button>
<input id="sys_logo_file" type="file" style="display: none;" name="sys_logo" value="{if !empty($applyinfo)}{$applyinfo['sys_logo']}{/if}" />
</div>
<img src="" id="slImg" />
jq Code
// Trigger upload event
$('#sys_logo').click(function(){
return $('#sys_logo_file').click();
});
// monitor input Change events After uploading, process the picture into base64 To preview
$('#sys_logo_file').on('change', function (e) {
var reader = new FileReader()
reader.readAsDataURL( e.currentTarget.files[0])
// obtain base64
reader.onload = function() {
$('#slImg').attr('src',reader.result)
}
})
That's it
边栏推荐
- Principle and application of single chip microcomputer -- Overview
- Unity WebGL发布无法运行问题
- External sorting and heap size knowledge
- Self learning neural network sequence -- 2 perceptron
- Edge computing is the sinking and extension of cloud computing capabilities to the edge and user sides
- Merrill Lynch data helps State Grid Hubei "golden eye" accurately identify abnormal power consumption
- 《单片机原理及应用》——概述
- Modify coco evaluation index maxdets=[10,15,20]
- Self taught neural network series - 1 Basic programming knowledge
- 《一周搞定模电》-二极管
猜你喜欢

Principle and application of single chip microcomputer -- Overview

【C】青蛙跳台阶和汉诺塔问题(递归)

【开源】使用PhenoCV-WeedCam进行更智能、更精确的杂草管理

《一周搞定模电》-二极管

Yolov5 advanced 4 train your own data set

【Sensors 2021】Relation-Based Deep Attention Network with Hybrid Memory for One-Shot Person Re-Id

《一周搞定模电》—基本放大电路

Practice of production control | dilemma on assembly rack

Super data processing operator helps you finish data processing quickly

Yolov5 advanced zero environment rapid creation and testing
随机推荐
【C】青蛙跳台阶和汉诺塔问题(递归)
Yolov5 advanced zero environment rapid creation and testing
Behavior tree file description
浅谈一下Type-C接口发展历程
Introduction to common classes on the runtime side
Board end power hardware debugging bug
51单片机ROM和RAM
Load other related resources or configurations (promise application of the applet) before loading the homepage of the applet
Phpcms V9 mall module (fix the Alipay interface Bug)
Detectron2 outputs validation loss during training
【Sensors 2021】Relation-Based Deep Attention Network with Hybrid Memory for One-Shot Person Re-Id
"One week's work on Analog Electronics" - power amplifier
【CVPR 2021】Joint Generative and Contrastive Learning for Unsupervised Person Re-identification
"One week's work on Analog Electronics" - Basic amplification circuit
How to solve the problem that NVIDIA model cannot be viewed by inputting NVIDIA SMI and quickly view NVIDIA model information of computer graphics card
php不让图片跟数据一起上传(不再是先上传图片再上传数据)
How to compile builds
thinkphp5使用composer安装插件提示php版本过高
MATLAB basic operation command
The most complete and simple nanny tutorial: deep learning environment configuration anaconda+pychart+cuda+cudnn+tensorflow+pytorch