|
@@ -188,12 +188,17 @@ class Core
|
|
|
|
|
|
header('Content-type: text/json; charset=utf-8');
|
|
header('Content-type: text/json; charset=utf-8');
|
|
|
|
|
|
- $file = file_get_contents($this->data['file']);
|
|
|
|
$path = Dever::path($this->base, 'tmp/');
|
|
$path = Dever::path($this->base, 'tmp/');
|
|
|
|
+ $name = $this->data['file'];
|
|
$this->data['file'] = array();
|
|
$this->data['file'] = array();
|
|
- $this->data['file']['name'] = 'Tmp' . Helper::rand(8) . md5(microtime() . rand(0,1000)) . '.jpg';
|
|
|
|
|
|
+ $this->data['file']['name'] = 'Tmp' . sha1($name);
|
|
|
|
+ //$this->data['file']['name'] = 'Tmp' . Helper::rand(8) . md5(microtime() . rand(0,1000)) . '.jpg';
|
|
$this->data['file']['tmp_name'] = $path . $this->data['file']['name'];
|
|
$this->data['file']['tmp_name'] = $path . $this->data['file']['name'];
|
|
- file_put_contents($this->data['file']['tmp_name'], $file);
|
|
|
|
|
|
+
|
|
|
|
+ if (!is_file($this->data['file']['tmp_name'])) {
|
|
|
|
+ $file = Dever::curl($name);
|
|
|
|
+ file_put_contents($this->data['file']['tmp_name'], $file);
|
|
|
|
+ }
|
|
$this->data['file']['size'] = filesize($this->data['file']['tmp_name']);
|
|
$this->data['file']['size'] = filesize($this->data['file']['tmp_name']);
|
|
|
|
|
|
} else {
|
|
} else {
|