我有一个应用程序,用户可以在其中上传图片文件。我使用 s3 进行存储。在我的本地计算机上,这工作正常,但是当我部署到 Heroku 时,每次我尝试上传(通过单击应用程序中的表单按钮)时,都会收到一条错误消息,提示““”文件不存在或不可读”。它在这行代码上崩溃:
$path = Storage::disk('s3')->put('images/profile', request('image'));
问题似乎出在 put 方法的输入上。我在该行代码之前根据 request('image') 进行了转储并死亡。在我的本地副本上,我看到的是:
Illuminate\Http\UploadedFile {#1236 ▼
-test: false
-originalName: "gary-bendig-6GMq7AGxNbE-unsplash.jpg"
-mimeType: "image/jpeg"
-error: 0
#hashName: null
path: "C:\xampp\tmp"
filename: "phpD90.tmp"
basename: "phpD90.tmp"
pathname: "C:\xampp\tmp\phpD90.tmp"
extension: "tmp"
realPath: "C:\xampp\tmp\phpD90.tmp"
aTime: 2020-06-30 20:09:05
mTime: 2020-06-30 20:09:05
cTime: 2020-06-30 20:09:05
inode: 5629499534269665
size: 2328835
perms: 0100666
owner: 0
group: 0
type: "file"
writable: true
readable: true
executable: false
file: true
dir: false
link: false
linkTarget: "C:\xampp\tmp\phpD90.tmp"
}
这是我在 Heroku 上看到的:
^ Illuminate\Http\UploadedFile {#1168 ▼
-test: false
-originalName: "gary-bendig-6GMq7AGxNbE-unsplash.jpg"
-mimeType: "application/octet-stream"
-error: 1
#hashName: null
path: ""
filename: ""
basename: ""
pathname: ""
extension: ""
realPath: "/app/public"
aTime: 1970-01-01 00:00:00
mTime: 1970-01-01 00:00:00
cTime: 1970-01-01 00:00:00
inode: false
size: false
perms: 00
owner: false
group: false
type: false
writable: false
readable: false
executable: false
file: false
dir: false
link: false
}
我猜这是某种文件系统权限问题,但欢迎提出想法。
守着星空守着你
陪伴而非守候