Hello, I'm trying to move a file (getting the file name from a textbox) from a folder to another. The folders must have the user name (that part looks to work), but I'm not sure where is the problem.
<?php
$user =& JFactory::getUser();
$username = $user->name;
$file = 'text_5'; //<-- you get the file name from the form textbox
$folder = JRequest::getString($username, '', 'post');
$path1 = JPATH_SITE.DS.'images'.DS.'mainfolder'.DS.'all'.DS.$folder;
$path2 = JPATH_SITE.DS.'images'.DS.'mainfolder'.DS.'all'.DS.'done'.DS.$folder;
if ( !JFolder::exists($path2) ) {
JFolder::create($path2);
}
$filename = basename($path1.DS.$file);
JFile::move($path1.DS.$filename, $path2.DS.$filename);
?>