peinhu / AetherUpload-Laravel

A Laravel package to upload large files 上传大文件的Laravel扩展包
GNU General Public License v2.0
919 stars 126 forks source link

添加了获取resource方法,方便获取资源进行后续处理 #78

Closed chanble closed 5 years ago

chanble commented 5 years ago

用法:

/**
 * 获取resource
 * @param string $name 文件名字
 * @param string $group 文件分组 对应config/aetherupload.php 下的group
 * @return AetherUpload\Resource
 */
function aetherupload_resource($name, $group = 'file')
{
    $subGroup = \AetherUpload\Util::generateSubDirName();
    $resource = new \AetherUpload\Resource($group, \AetherUpload\ConfigMapper::get('group_dir'), $subGroup, $name);
    return $resource;
}
peinhu commented 5 years ago

\AetherUpload\Util::generateSubDirName()是根据当月或当天的日期生成子目录名,这里只能访问到当天上传的资源,如果是昨天上传今天完成,或者上个月30号上传这个月1号完成,就可能出问题。

chanble commented 5 years ago

没注意, 我改下