我正在使用angularJS和PHP來上傳文件。從angularJS部分我送斑點網址是這樣的:文件上傳不起作用 - AngularJS和PHP
{
$ngfBlobUrl: "blob:http://test.dev/91458ff7-fc18-4bbc-8dae-f06941e0a1c9"
selectedCategory: "1",
name: "some_file_name.pdf"
}
和PHP方面我想從BLOB網址獲取文件並將其保存在本地存儲。
這是我在服務器端代碼:
$blob = $file['$ngfBlobUrl'];
$f_name = $file['name'];
$filename = uniqid() . '_' .$f_name; // generate unique file name
if(@file_put_contents($destination.'/'.$filename, @file_get_contents($blob)))
{
// do something!
}
的file_get_contents()函數返回未能打開流:無效的參數。當我在瀏覽器中加載PDF文件時,URL是正確的。
有沒有人有一個想法如何解決這個問題或使用另一種方式從指定的BLOB網址讀取文件。
在此先感謝!
'$ file'從哪裏來? – cweiske
$ file = $ request-> documents;我使用laravel和Request對象來讀取json。 –
$ request->文檔代表上面的對象。 –