File Upload field issue #286
-
I'm trying to upload images using backpack's File Upload field and store them in the /uploads folder. The field appears in the admin interface, allows me to browse files, but the chosen image isn't uploaded to the server and I don't get any errors. I followed the official documentation thoroughly + applied advice found on forums (none of which worked), so I assume this might be a bug( In my CrudController: CRUD::addField([
'name' => 'image',
'label' => 'Image',
'type' => 'upload',
'upload' => true,
'disk' => 'uploads',
]); In my Model: public function setImageAttribute($value)
{
$attribute_name = "image";
$disk = "uploads";
$destination_path = ""; //relative to $disk
$this->uploadFileToDisk($value, $attribute_name, $disk, $destination_path);
} In 'disks' => [
'uploads' => [
'driver' => 'local',
'root' => env('APP_URL') . '/public_html/uploads', //btw, my public folder is called public_html
'url' => env('APP_URL') . '/uploads',
'visibility' => 'public',
],
... I would appreciate any help with that) |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 1 reply
-
Hello there! Thanks for opening your first issue on this repo! Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that. Backpack communication channels:
Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch. Thank you! -- |
Beta Was this translation helpful? Give feedback.
-
I've just tested this and it worked fine - so I'm pretty sure it's not a Backpack bug, but an implementation issue. I can't spot anything obvious from your code... I'd recommend you go one-by-one in the lines above, If the field is visible, no need to test that. So I'd start with the Model, inside the 99% of the times this is an issue with how the filesystem is configured though. Try it the same way it's done inside our demo too (where it's 100% working). In fact, if you end up with nothing, you can install the demo too, to see if it works as-is (it should). Hope it helps. |
Beta Was this translation helpful? Give feedback.
-
Hi, using dd(request()) shows me that no file is coming to be taken by 'uploadFileToDisk' function to store, so DB is correctly updated while no file is written to disk as CRUD 'upload' field seems to bring no file at all to server side when trying to create/update a model with that 'upload' field populated with any local file. Weird |
Beta Was this translation helpful? Give feedback.
-
Not sure but might be because file uploads are disabled in demo?
Did you tried in a new laravel installation with backpack?
Let me know,
Pedro
A quinta, 29/07/2021, 12:07, MBC Servicios Audiovisuales <
***@***.***> escreveu:
… Hi,
using the demo I can see with dd(request()) that no file is coming to be
taken by 'uploadFileToDisk' function to store, so DB is correctly updated
while no file is written to disk as CRUD 'upload' field seems to bringing
no file at all to server side when trying to create/update a model with
that 'upload' field. Weird
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<https://github.com/Laravel-Backpack/CRUD/discussions/3641#discussioncomment-1086612>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABW25PZTSSZ4FSVLBVZS33LT2EZADANCNFSM42EUA7TQ>
.
|
Beta Was this translation helpful? Give feedback.
-
Hi. Due to not activity on many years i will close this discussion, if there is needed feel free to reopen or create a new one. Cheers. |
Beta Was this translation helpful? Give feedback.
-
Also as of now (Backpack 6) you can use the https://backpackforlaravel.com/docs/6.x/crud-uploaders to make the uploading of files a breeze in Backpack. Cheers |
Beta Was this translation helpful? Give feedback.
Also as of now (Backpack 6) you can use the https://backpackforlaravel.com/docs/6.x/crud-uploaders to make the uploading of files a breeze in Backpack.
Cheers