Level 35
What is the expected output? Because your variable $file is not a string, it is an UploadedFile object that is turned into a string which probably causes the private/var/tmp/phpUaKP8q path.
I am uploading a file to DO Spaces using this code with the data-points of (id: 650, doc: 'shop_report')
public function doc_upload(Request $request)
{
$file = $request->file('file');
$id = $request->id;
$doc = $request->doc;
$ext = $file->getClientOriginalExtension();
$fileName = $doc . '.' . $ext;
$upload_success = Storage::disk('spaces')
->putFileAs("RMA/{$id}/$file", $file, $fileName, 'public');
if ($upload_success) {
$rma = ReturnsRequest::whereId($id)->first();
$rma[$doc] = $fileName;
$rma->save();
return $rma;
} else {
return response()->json('error', 419);
} // end if
} // end function
On Spaces, I get the following structure:
650
private
var
tmp
phpUaKP8q
shop_report.pdf
Any insight is welcome.
What is the expected output? Because your variable $file is not a string, it is an UploadedFile object that is turned into a string which probably causes the private/var/tmp/phpUaKP8q path.
Please or to participate in this conversation.