You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to have a file field in a UI where I can chose a picture in UI, save the picture in my remote storage and set a link to the picture to logo field in the model.
This is my configuration for the model
publicgetResource(componentLoader: ComponentLoader): ResourceWithOptions{return{resource: InstitutionModel,options: {parent: {name: 'Entities'},properties: this.getProperties(),actions: {new: {before: (request: any)=>{// I expect to get information about files hereconsole.log(request.payload);if(request.payload.uploadedLogoFile){request.payload.logo=awaitthis.uploadFile((request.payload.uploadedLogoFile);// uploadFile expects a Buffer}returnrequest;},}},},features: [uploadFeature({
componentLoader,provider: {local: {bucket: this.rootFolder,opts: {},},},properties: {// virtual properties, created by this plugin on the go. They are not stored in the database// this is where frontend will send info to the backendfile: 'uploadedLogoFile',key: 'uploadedLogo',},uploadPath: (record,filename)=>{consttime=newDate().getTime();return'${this.logoFolder}/${time}-${filename}';},}),],};}
But I don't see any file information in either field payload or field request.
I dig payload and I have found information about original file with original name. But I don't see a path of the file on disc and I don't see a Buffer.
In the end I had to implement a hack: I got the information in after (there is path to the file on disk). But I had to save my model again there.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello
I just started work with AdminJS.
I use TypeORM and NestJS and I tried to setup update my model with logo.
My model is:
I want to have a file field in a UI where I can chose a picture in UI, save the picture in my remote storage and set a link to the picture to
logo
field in the model.This is my configuration for the model
But I don't see any file information in either field payload or field request.
I dig payload and I have found information about original file with original name. But I don't see a path of the file on disc and I don't see a Buffer.
In the end I had to implement a hack: I got the information in
after
(there is path to the file on disk). But I had to save my model again there.It looks really strange.
I think I don't know something and I do it wrong.
Please help me to find out how to set up it correctly.
Beta Was this translation helpful? Give feedback.
All reactions