On my page users can upload documents, which will be saved in a user specific folder. the directories are stored in a url: http://localhost/folder/user/documentA_user_timestamp.ext
inside a database.
Users can also delete a file, which deletes the file's entry inside the database but i want the file to be moved to a specified archive folder. However i always get this error message when the php rename() tries to do its work:
http wrapper does not support renaming in...
I can't seem to get my head around the error message and figure out whats the cause for it
$filepath = $_POST['file'];
$archivePath = FILESYS_DOCS_ARCHIVE . basename($filepath);
if (!file_exists(FILESYS_DOCS_ARCHIVE)){
mkdir(FILESYS_DOCS_ARCHIVE, 0777);
}
$success = rename($filepath, $archivePath);
if ($success){
echo "SUCCess";
} else {
echo $archivePath;
}
use this
$dir = str_replace('http://','',base_url()); rename($dir.'older filename', $dir.'/new filename' )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.