Comments (1)
抱歉这么久才回复。
对于文件名的处理,都在includes/functions.upload.php
中,有如下几处:
扩展名处理
主要是根据MIME类型统一扩展名,同时也是一个安全处理,避免非图片文件上传。
位置在第71行到96行,以及159到184行,两处的代码是一样的。
文件重命名处理
主要是针对重名文件,98行和187行都调用了·rename_if_exists·函数,该函数在249行到276行。
这里返回的就是最终的文件名,在下一行(99行和188行)就和上传目录拼接成最终的保存路径。
所以你要实现随机命名的话,可以修改·rename_if_exists·,该函数传入原文件名以及上传目录,返回新文件名(不包含上传目录)。
亦可修改98行和187行,调用你自己的文件名处理函数。在99行或188行之前处理文件名即可。
from qchan.
Related Issues (13)
- IE11 上传不了图片 HOT 4
- 可否添加移动版浏览器支持呢
- config.php中的配置具体要怎样修改? HOT 1
- Trying to get in touch regarding a security issue HOT 1
- manage/的登录密码是什么? HOT 1
- Security contact HOT 1
- manage无法管理,所有上传的图片管理页都看不到,只能ftp管理 HOT 6
- 小建议 HOT 3
- 无法选择语言,已经后台登陆之后是空白的 HOT 3
- 建议:前端处理对图进行处理后上传。
- 关于按照MD5来重命名文件 HOT 1
- 若安装到二级目录,管理后台不显示缩略图
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qchan.