Closed alexandrosraikos closed 2 months ago
This sounds like correct behavior, and is how saving and retrieving files works in general. Laravel stores an upload file and assigns it a random, temporary name. If you want to use the uploaded file's original name you should call the function to save it as such. For native laravel storage you'd use something like:
$file = $request->file('photo');
$file->store('uploads'.'/'.$file->getClientOriginalName());
if you wanted to save the file with the original name.
Here's an example for saving to a FileMaker container:
$file = $request->file('photo');
$pet = new Pet();
$pet->photo = [$file, $file->getClientOriginalName()];
$pet->save();
NOTE: This might seem very similar to #70, but it concerns the original filename, not the array instance with the custom file name.
Dependencies
Description of the issue:
Uploaded form files (
UploadedFile
instances) don't get saved to containers with the proper original filename in the container fields. They are being saved with the temporary PHP blob upload name (phpXXXXX
without extension).Expected Behavior:
The file should be uploaded with its original file name.
Steps to reproduce:
UploadedFile
on the attribute which reflects the container attribute.SomeModel->save()
Additional Information
After a quick debugging session, I noticed that the file name retrieval in
GearboxSolutions\EloquentFileMaker\Services\FileMakerConnection::uploadToContainerField
uses$file->getFilename
instead of$file->getClientOriginalName()
. I can confirm that changing it locally did fix my issue, but just want to confirm with you.