Skip to content

storing problem with local upload feature #608

@everythinginjs

Description

@everythinginjs

Hello dear SoftwareBrothers,

I have upgraded my Admin Bro to version 3 and set up file upload feature but when I would like to submit an article with a dropped image I get upload Errors. The same thing goes when I get back to the old version of admin bro and used the one that I wrote through components. I cannot figure out what's exactly going wrong.

this is the error I get when I submit an article with Image.

Screen Shot 1399-06-27 at 11 26 05

My Blog js

const AdminBro = require('admin-bro');
const { Blog } = require('../../models/Blog');
const { sort, timestamps } = require('../sort');
const uploadFeature = require('@admin-bro/upload');



/** @type {AdminBro.ResourceOptions} */
const options = {
    sort,
    properties: {
        ...timestamps,
        slug: {
            position: 0,
        },
        description: {
            isVisible: { list: false, edit: true, filter: false, show: true },
            position: 1,
            components: {
                edit: AdminBro.bundle('../components/custom-fonts.edit.tsx')
            }
        },
        tags: {
            isVisible: { list: false, edit: true, filter: true, show: true },
            position: 8
        },
        keywords: {
            isVisible: { list: false, edit: true, filter: true, show: true },
            position: 9,
            type: [String],
        },
        draftMode: {
            isVisible: { list: true, edit: true, filter: true, show: true }
        },
        _id: {
            isVisible: { list: false, edit: false, filter: false, show: false },
        },
    }
};

module.exports = {
    options,
    features: [
        uploadFeature({
            provider: { local: { bucket: 'public/uploads' } },
            properties: {
                key: 'uploadedFile.path',
                bucket: 'uploadedFile.folder',
                mimeType: 'uploadedFile.type',
                size: 'uploadedFile.size',
                filename: 'uploadedFile.filename',
                file: 'uploadFile',
            }
        })
    ],
    resource: Blog,
};

my app.js

app.use('/uploads', express.static('uploads'));

and I also made a directory by the name of upload on the root folder of my app.

so thankful for supporting this amazing admin panel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions