上传图片用的复制--获取文件的前缀..
来源:互联网 发布:哈尔滨网络电视台 编辑:程序博客网 时间:2024/06/17 15:33
这是获取上传的文件名后再进行复制处理的函数
/** * 复制文件 * * @param string $imagesPath 公共文件的目录 * @param string $articlePathFile 要上传到的目录 * @param string $size 图片大小,例130_ * @param string $post post过来的值 * @param string $prefix 文件前缀 * @return boolean */ function upfile($imagesPath,$articlePathFile,$size,$post,$prefix){ //生成当天的文件夹 $time = time(); $date = date('Ymd',$time); //获取post值,并判断 //准备要复制文件路径 $articlePathFiles = $articlePathFile.$prefix.'/'.$date.'/'.$post; //获取前缀 $prefix = substr($size.$post,0,strpos($size.$post,'_')+1); //无前缀的路径 $articlePath = $articlePathFile.$prefix; //查看目录 if(!file_exists($articlePath)){ //创造前缀路径 mkdir($articlePath); //创建带前缀的时间路径 $articlePath = $articlePathFile.$prefix.'/'.$date; mkdir($articlePath); }else{ //创建时间路径 $articlePath = $articlePathFile.$prefix.'/'.$date; mkdir($articlePath); } //准备公共图片的文件地址 $imagesPaths = $imagesPath.$size.$post; //查看是否有重名文件 if(file_exists($articlePathFiles)){ $random = random(3,0); //如果有,在前面加一个3位随机码 $articlePathFiles = $articlePathFile.$prefix.'/'.$date.'/'.$random.$size.$post; } //复制到目录 copy($imagesPaths,$articlePathFiles); //删除源文件 @unlink($imagesPaths); }
0 0
- 上传图片用的复制--获取文件的前缀..
- jsp中获取文件的绝对路径前缀
- 图片文件的上传
- java文件,图片的复制
- 页面中在上传之前获取上传文件的路径(例子:获取上传图片的路径,获得上传图片的大小:长度和宽度)
- 页面中在上传之前获取上传文件的路径(例子:获取上传图片的路径,获得上传图片的大小:长度和宽度)
- 图片上传的JSP文件
- 上传文件图片的代码
- SpringMVC的图片(文件)上传
- 生成上传图片的文件
- springmvc 文件上传,图片上传的方法
- 获取上传的文件字
- 获取上传文件的路径
- 获取上传文件的文件名~~
- 获取上传文件的文件名
- java、sftp文件服务器的操作(获取链接。上传、下载,删除,获取图片或者文件)
- 在客户端获取上传图片的大小
- 怎样获取上传图片的长宽?
- Xcode安装插件方法(大白适用)与几个实用的插件
- UVa 819- Gifts Large and Small
- 黑白BMP文件的读写和数据黑白图像显示
- struts2生成验证码图片
- HTML5(一)HTML5表单类型与属性
- 上传图片用的复制--获取文件的前缀..
- Http方法之PUT
- 从Membership 到 .NET4.5 之 ASP.NET Identity
- 理解HTTP幂等性(转载)
- Maven+Mybatis+Spring+SpringMVC实现分页查询(附源码)
- J2EE基本介绍
- PHP之生成一个随机数
- Python简单爬虫(爬取天气信息)
- 关于REST架构