dcasia / nova-filepond

A Nova field for uploading File, Image and Video using Filepond.
MIT License
48 stars 27 forks source link

Use of storeOriginalName #10

Closed vayurobins closed 11 months ago

vayurobins commented 4 years ago

Hi. Is it not possible to use the builtin functions, that the File Field has in Nova? https://nova.laravel.com/docs/2.0/resources/file-fields.html#storing-metadata For instance, is it not possible to use storeOriginalName()?

By the way, this extension is really good, thanks for sharing!

naifalshaye commented 4 years ago

use Illuminate\Http\File instead of use Laravel\Nova\Fields\File

milewski commented 4 years ago

@naifalshaye what are you talking about?

naifalshaye commented 4 years ago

@milewski How I'm supposed to use storeOriginalName() method in Nova File Field?

milewski commented 4 years ago

@naifalshaye see my reply to this PR https://github.com/dcasia/nova-filepond/pull/13, you can use it meanwhile I still havent complete the rework for v2

danmatthews commented 4 years ago

Any word on when this might become available? I've used this package in a piece of work, but it's no good unless I can store the original filename too.

Great package btw.

milewski commented 4 years ago

Unfortunately, I still haven't got time to finish it :( I faced some issues with the package especially allowing multiple files upload... that's trouble there were too many cases to handle..

vayurobins commented 4 years ago

I think it should be possible to store files with original name like this. I have not tested this, but I think it could work until storeOriginalName() is added. Please correct me if I'm wrong.

Filepond::make(__('Invoices'), 'invoices')->storeAs(function (File $file) {
    return $file->getClientOriginalName() . '.' . $file->getExtension();
})
milewski commented 4 years ago

the File is not the real uploaded file object but a mock I create, the original information from the UploadedFile object is lost, this PR #13 adds it to a temp json file and retrieve it back when the user clicks save, not idea solution, my rewrite I was encoding all these missing information directly into the serverid that is transferred between the requests... but I think I won't have time to finish it so soon

danmatthews commented 4 years ago

Ok Cool, i might have to fork the package and use this pull request then, as i really need this functionality. Thanks for all the work you've put in on it so far!

milewski commented 11 months ago

Hi latest version supports nova 4 and fixes a lot of issues, now you can store original name + anything else you would like the same way you can do with the native nova file field: v1.0.0