Pasting a new file

Looks to see if the location is writable and if so, copy our file to
that location
Then adds the new file to the file manager, otherwise, informs you it
couldn't do it
Clears server message eitherway
This commit is contained in:
Matt Pass
2012-11-12 09:26:50 +00:00
parent 99dedb61cb
commit c4d24c0a4c

View File

@@ -52,6 +52,19 @@ if ($_GET['action']=="newFolder") {
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
}
// If we're due to paste a new file...
if ($_GET['action']=="paste") {
$location = $docRoot.strClean(str_replace("|","/",$_GET['location']));
if (is_writable($location)) {
copy($file, $location."/".basename($file));
// Reload file manager
echo '<script>top.ICEcoder.selectedFiles=[];top.ICEcoder.updateFileManagerList(\'add\',\''.str_replace($docRoot,"",$location).'\',\''.$fileName.'\');action="pasteFile";</script>';
} else {
echo "<script>action='nothing'; top.ICEcoder.message('Sorry, cannot copy file into \\n".$location."')</script>";
}
echo '<script>top.ICEcoder.serverMessage();top.ICEcoder.serverQueue("del",0);</script>';
}
// If we're due to rename a file/folder...
if ($_GET['action']=="rename") {
if (is_writable($docRoot.$iceRoot.str_replace("|","/",strClean($_GET['oldFileName'])))) {