|
@@ -413,14 +413,26 @@ class Core
|
|
|
|
|
|
protected function getName()
|
|
|
{
|
|
|
- $this->path()->name($this->data['file']['name'])->ext()->file();
|
|
|
+ $this->name($this->data['file']['name'])->path()->ext()->file();
|
|
|
}
|
|
|
|
|
|
protected function path()
|
|
|
{
|
|
|
- $date = explode('-', date("Y-m-d"));
|
|
|
+ # 覆盖原文件 检查文件是否存在
|
|
|
+ $this->path = '';
|
|
|
+ if ($this->config['cover'] == 1) {
|
|
|
+ $info = Dever::db('upload/file')->one(array('name' => $this->name));
|
|
|
+ if ($info && $info['file'] && strstr($info['file'], $this->name)) {
|
|
|
+ # 如果存在,直接使用旧文件
|
|
|
+ $temp = explode($this->name, $info['file']);
|
|
|
+ $this->path = $temp[0];
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- $this->path = $this->config['id'] . '/' . $date[0] . '/' . $date[1] . '/' . $date[2] . '/';
|
|
|
+ if (!$this->path) {
|
|
|
+ $date = explode('-', date("Y-m-d"));
|
|
|
+ $this->path = $this->config['id'] . '/' . $date[0] . '/' . $date[1] . '/' . $date[2] . '/';
|
|
|
+ }
|
|
|
|
|
|
return $this;
|
|
|
}
|