Closed leonardorame closed 9 years ago
@jeromemacias any insight?
To get a complete url for your entity you have to retrieve the baseApiUrl
you previously define in your ng-admin Application configuration and retrieve entity
name.
For example: .uploadInformation({url: baseApiUrl + yourEntity.name() + '/upload/:id'})
Thanks @jeromemacias for writing, but the string '/upload/:id' is not replaced to the correct identifier, i.e.: /upload/123. How can I get that identifier?.
Mmm, exact, but how we can handle the creation part ? I think you need to do the binding between the upload file and the entity when the form is submitting, using the filename returning by upload.
@jeromemacias for now, on the creation part I forbid uploading images.
Your suggestion implies the existence of an event after upload, does anyone know which event is fired after upload?.
BTW, I don't know why the upload POST is sent just after selecting a file instead of sending the whole package on form submission.
I finally store all files in an /upload directory, then, when submitting the form, there's an upload_filename param with the recently uploaded file.
Using the upload_filename param I can store it's path in my database.
Please help me . i develop an admin page for a website and i don't now how to upload image with ng-admin
I have the same problem as @jeanlucDjeke . Can anyone help us with that?
here's my code:
companies.creationView() .fields([ nga.field('name') .validation({ required: true }), nga.field('logo', 'file').uploadInformation({ 'fileName': nga.field('name') + '.png', 'url': (baseurl + 'companies/logos'), 'method': 'PUT'})
]);
but do I need to put some server-side code? how can I see the image?
thank you, guys.
Hi Jean,
Actually I don't have a server side for that.. I can't find a place to do that. I was hoping someone could come up with an explanation about how to do an upload using ng-admin properly.
=/
On Thu, Mar 10, 2016 at 12:23 PM, Jean-Luc DJEKE notifications@github.com wrote:
Thanks you for your answer. Yes .please if you can, put your server side code(i use an api built with slim in php) and how to see the image
— Reply to this email directly or view it on GitHub https://github.com/marmelab/ng-admin/issues/311#issuecomment-194965764.
Att, Hugo S. Mendes
Analista de Sistemas
ITIL® V3 Foundation 55.81-9910.1992
ok thank you.I hope someone else did it
I added a field type to one of my entities. After I click browse and select the file, the file is uploaded automatically. But it does a post to /upload route, how can I create a custom url passing the entity Id?.
for example:
.uploadInformation({url: route_of_entity + '/upload/:id'})
This should give something like: 'item/upload/21'.
Also, how can I get the route of an entity?.