|
|
|
|
@ -1,23 +1,23 @@ |
|
|
|
|
<?php |
|
|
|
|
/** |
|
|
|
|
* File Utilities. |
|
|
|
|
* @author Wei Zhuo |
|
|
|
|
* @version $Id: Files.php,v 1.2 2006/12/16 21:38:13 thierrybo Exp $ |
|
|
|
|
* @package ImageManager |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
<?php |
|
|
|
|
/** |
|
|
|
|
* File Utilities. |
|
|
|
|
* @author Wei Zhuo |
|
|
|
|
* @version $Id: Files.php,v 1.2 2006/12/16 21:38:13 thierrybo Exp $ |
|
|
|
|
* @package ImageManager |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
define('FILE_ERROR_NO_SOURCE', 100); |
|
|
|
|
define('FILE_ERROR_COPY_FAILED', 101); |
|
|
|
|
define('FILE_ERROR_DST_DIR_FAILED', 102); |
|
|
|
|
define('FILE_COPY_OK', 103); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* File Utilities |
|
|
|
|
* @author Wei Zhuo |
|
|
|
|
* @version $Id: Files.php,v 1.2 2006/12/16 21:38:13 thierrybo Exp $ |
|
|
|
|
* @package ImageManager |
|
|
|
|
* @subpackage files |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* File Utilities |
|
|
|
|
* @author Wei Zhuo |
|
|
|
|
* @version $Id: Files.php,v 1.2 2006/12/16 21:38:13 thierrybo Exp $ |
|
|
|
|
* @package ImageManager |
|
|
|
|
* @subpackage files |
|
|
|
|
*/ |
|
|
|
|
class Files |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
@ -64,9 +64,14 @@ class Files |
|
|
|
|
if (!copy($source, $destination_dir.$filename)) |
|
|
|
|
return FILE_ERROR_COPY_FAILED; |
|
|
|
|
|
|
|
|
|
global $permissions_for_new_files; |
|
|
|
|
|
|
|
|
|
//verify that it copied, new file must exists |
|
|
|
|
if (is_file($destination_dir.$filename)) |
|
|
|
|
{ |
|
|
|
|
@chmod($destination_dir.$filename, $permissions_for_new_files); |
|
|
|
|
Return $filename; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
return FILE_ERROR_COPY_FAILED; |
|
|
|
|
} |
|
|
|
|
@ -78,8 +83,13 @@ class Files |
|
|
|
|
*/ |
|
|
|
|
function createFolder($newFolder) |
|
|
|
|
{ |
|
|
|
|
mkdir ($newFolder, 0777); |
|
|
|
|
return chmod($newFolder, 0777); |
|
|
|
|
//mkdir ($newFolder, 0777); |
|
|
|
|
//return chmod($newFolder, 0777); |
|
|
|
|
|
|
|
|
|
global $permissions_for_new_directories; |
|
|
|
|
|
|
|
|
|
mkdir ($newFolder, $permissions_for_new_directories); |
|
|
|
|
return @chmod($newFolder, $permissions_for_new_directories); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -209,7 +219,7 @@ class Files |
|
|
|
|
return sprintf('%01.2f',$size/1024.0).' Kb'; |
|
|
|
|
else |
|
|
|
|
return sprintf('%01.2f',$size/(1024.0*1024)).' Mb'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
?> |
|
|
|
|
|