[英]Save a file to a different folder using php?
I want to know if it is possible to save a file to a different folder once it is opened. 我想知道打开文件后是否可以将文件保存到其他文件夹中。 My current logic is -
我目前的逻辑是-
$myfile = $_POST['file']; // gets path of (in this case an image)
$size = getimagesize($myfile); //for some reason I get an error message when this fails
// I'm assuming there is a better way of determining if the file is an image file or not.
if($size)
{
//save file to said file path
}
Try: 尝试:
if($size)
{
copy($myfile, $newfile); //$newfile - with full path!
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.