|
@@ -1266,7 +1266,8 @@ public function testFile(Request $request){
|
|
$file = $request->file('file');
|
|
$file = $request->file('file');
|
|
$filename = $this->uploadItemBillFile($file);
|
|
$filename = $this->uploadItemBillFile($file);
|
|
// 使用 'public' 磁盘驱动来获取文件路径
|
|
// 使用 'public' 磁盘驱动来获取文件路径
|
|
- $filePath = Storage::disk('public')->path('big_tree\\'.$filename);
|
|
|
|
|
|
+ $filePath = Storage::disk('public')->path('big_tree/'.$filename);
|
|
|
|
+ $realPath = realpath($filePath);
|
|
|
|
|
|
$url = $data['url'];
|
|
$url = $data['url'];
|
|
$header = $data['header'];
|
|
$header = $data['header'];
|
|
@@ -1276,6 +1277,7 @@ public function testFile(Request $request){
|
|
|
|
|
|
curl_setopt_array($curl, array(
|
|
curl_setopt_array($curl, array(
|
|
CURLOPT_URL => $url,
|
|
CURLOPT_URL => $url,
|
|
|
|
+// CURLOPT_VERBOSE => true,
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
CURLOPT_ENCODING => '',
|
|
CURLOPT_ENCODING => '',
|
|
CURLOPT_MAXREDIRS => 10,
|
|
CURLOPT_MAXREDIRS => 10,
|
|
@@ -1283,10 +1285,12 @@ public function testFile(Request $request){
|
|
CURLOPT_FOLLOWLOCATION => true,
|
|
CURLOPT_FOLLOWLOCATION => true,
|
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
CURLOPT_CUSTOMREQUEST => 'POST',
|
|
CURLOPT_CUSTOMREQUEST => 'POST',
|
|
- CURLOPT_POSTFIELDS => ['file' => new \CURLFile($filePath)],
|
|
|
|
-// CURLOPT_HTTPHEADER => $header,
|
|
|
|
|
|
+ CURLOPT_POSTFIELDS => ['file' => new \CURLFile($realPath)],
|
|
|
|
+// CURLOPT_HTTPHEADER => ["Content-Type:application/json;charset=UTF-8"],
|
|
));
|
|
));
|
|
$response = curl_exec($curl);
|
|
$response = curl_exec($curl);
|
|
|
|
+// $info = curl_getinfo($curl);
|
|
|
|
+
|
|
curl_close($curl);
|
|
curl_close($curl);
|
|
Storage::disk('public')->delete('big_tree\\'.$filename);
|
|
Storage::disk('public')->delete('big_tree\\'.$filename);
|
|
|
|
|
|
@@ -1297,14 +1301,15 @@ public function testFile(Request $request){
|
|
// 获取文件相关信息
|
|
// 获取文件相关信息
|
|
$ext = $file->getClientOriginalExtension(); // 扩展名
|
|
$ext = $file->getClientOriginalExtension(); // 扩展名
|
|
$realPath = $file->getRealPath(); //临时文件的绝对路径
|
|
$realPath = $file->getRealPath(); //临时文件的绝对路径
|
|
|
|
+ $filename = $file->getClientOriginalName();//上传文件名
|
|
|
|
|
|
// 上传文件
|
|
// 上传文件
|
|
- $file_name = time().rand(1000,9999);
|
|
|
|
- $filename = $file_name.'.' . $ext;
|
|
|
|
|
|
+// $file_name = time().rand(1000,9999);
|
|
|
|
+// $filename = $file_name.'.' . $ext;
|
|
// 使用我们新建的uploads本地存储空间(目录)
|
|
// 使用我们新建的uploads本地存储空间(目录)
|
|
Storage::disk('public')->put('big_tree/'.$filename, file_get_contents($realPath));
|
|
Storage::disk('public')->put('big_tree/'.$filename, file_get_contents($realPath));
|
|
|
|
|
|
- return $file_name. '.' .$ext;
|
|
|
|
|
|
+ return $filename;
|
|
}
|
|
}
|
|
|
|
|
|
public function testaa(Request $request){
|
|
public function testaa(Request $request){
|