作者 lyh

gx

@@ -66,7 +66,7 @@ class AmazonS3Service @@ -66,7 +66,7 @@ class AmazonS3Service
66 */ 66 */
67 public function syncImageFiles($files) 67 public function syncImageFiles($files)
68 { 68 {
69 - $location = ltrim(str_replace_url($files),'/'); 69 + $location = '/tmp'.str_replace_url($files);
70 $file_link = $this->fetchRemoteImage($files,$location); 70 $file_link = $this->fetchRemoteImage($files,$location);
71 $key = str_replace_url($files); 71 $key = str_replace_url($files);
72 try { 72 try {
@@ -82,6 +82,7 @@ class AmazonS3Service @@ -82,6 +82,7 @@ class AmazonS3Service
82 'Key' => ltrim($key,'/'), 82 'Key' => ltrim($key,'/'),
83 'Body' => $file_content, 83 'Body' => $file_content,
84 ]); 84 ]);
  85 + unlink($location);
85 return $result['ObjectURL']; 86 return $result['ObjectURL'];
86 } catch (AwsException $e) { 87 } catch (AwsException $e) {
87 return '上传文件到S3时发生错误:' . $e->getMessage(); 88 return '上传文件到S3时发生错误:' . $e->getMessage();