[英]PHP upload file to multiple folders
I'm sure there is a pretty straight forward answer to this but I am new to PHP and can't find an answer I can get to work. 我敢肯定有一个很简单的答案,但是我是PHP新手,找不到可以工作的答案。 Basically I have a PHP form with a file upload which needs to send images to two folders. 基本上我有一个带有文件上传功能的PHP表单,需要将图像发送到两个文件夹。 The current code that tells the images where to be stored is as follows: 告诉图像存储位置的当前代码如下:
$savepath = JPATH_SITE.DS.'images'.DS.'site'.DS.'cache';
Then after the image is uploaded: 然后在上传图片后:
$handle->Process($savepath);
Is there an easy way of also copying the file to another folder as part of the upload process? 在上传过程中,是否有一种简便的方法也可以将文件复制到另一个文件夹?
Thanks in advance! 提前致谢!
$file = "/path/to/orig/file";
$newfile = "/path/to/dest/file";
copy($file, $newfile);
Repeat the copy()
command as many times as necessary to copy to multiple directories. 根据需要重复多次copy()
命令以复制到多个目录。
Good luck! 祝好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.