当前位置:网站首页>php不让图片跟数据一起上传(不再是先上传图片再上传数据)
php不让图片跟数据一起上传(不再是先上传图片再上传数据)
2022-06-26 08:50:00 【因起名而头秃】
使用jq实现功能
html做一个自己喜欢的按钮样式,并做一个input file作为上传对象
博主使用的是layui的上传按钮样式 给按钮和input添加上一个id
<div class="layui-input-block">
<button type="button" class="layui-btn layui-btn-primary" id="sys_logo">
<i class="layui-icon"></i>上传图片
</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代码
//触发上传事件
$('#sys_logo').click(function(){
return $('#sys_logo_file').click();
});
//监控input改变事件 上传后将图片处理成base64进行预览
$('#sys_logo_file').on('change', function (e) {
var reader = new FileReader()
reader.readAsDataURL( e.currentTarget.files[0])
// 获取base64
reader.onload = function() {
$('#slImg').attr('src',reader.result)
}
})
这样就完成了
边栏推荐
- phpcms小程序插件4.0版正式上线
- 什么是乐观锁,什么是悲观锁
- Detectron2 save (according to maxap50) model during training_ best. PTH weight
- Yolov5 advanced 4 train your own data set
- Statistics of various target quantities of annotations (XML annotation format)
- Practice is the fastest way to become a network engineer
- Phpcms V9 background article list adds one click push to Baidu function
- Edit type information
- 微信小程序如何转换成百度小程序
- Yolov5 advanced III training environment
猜你喜欢

Uniapp uses uparse to parse the content of the background rich text editor and modify the uparse style
![Li Kou 399 [division evaluation] [joint query]](/img/25/ea7d526c0628f11277141f51d4ccae.png)
Li Kou 399 [division evaluation] [joint query]

Data warehouse (3) star model and dimension modeling of data warehouse modeling

External sorting and heap size knowledge

PD fast magnetization mobile power supply scheme

Bbox format conversion (detectron2 function library)

MySQL在服务里找不到(未卸载)

Yolov5 advanced 5 GPU environment setup

phpcms v9商城模块(修复自带支付宝接口bug)

phpcms手机站模块实现自定义伪静态设置
随机推荐
【开源】使用PhenoCV-WeedCam进行更智能、更精确的杂草管理
phpcms v9商城模块(修复自带支付宝接口bug)
关于小程序tabbar不支持传参的处理办法
Li Kou 399 [division evaluation] [joint query]
phpcms小程序插件api接口升级到4.3(新增批量获取接口、搜索接口等)
phpcms小程序插件教程网站正式上线
Phpcms V9 mobile phone access computer station one-to-one jump to the corresponding mobile phone station page plug-in
[qnx hypervisor 2.2 user manual]12.1 terminology (I)
2021 software university ranking crawler program
Analysis of ROS calculation diagram level
Behavior tree file description
挖财打新债安全吗
Self taught neural network series - 1 Basic programming knowledge
常用电路设计
Unity connects to Turing robot
Dedecms applet plug-in is officially launched, and one click installation does not require any PHP or SQL Foundation
Phpcms applet interface new universal interface get_ diy. php
Code de mise en œuvre de l'intercepteur et du filtre
板端电源硬件调试BUG
Particles and sound effect system in games104 music 12 game engine