m-inan / react-upload-gallery

React for Upload Image Gallery. Sorted by drag & drop and Customizable
MIT License
78 stars 44 forks source link

After upload image issue #20

Closed Ahmadh26 closed 3 years ago

Ahmadh26 commented 3 years ago

after uploading the image or images, the cards don't show them, they're blank and don't show the actual images. what could cause that?

this is my code:

        <>
        <RUG
            action='http://localhost/API/uploadFile.php'// upload route
            source={response => response.source} // response image source
            rules={{ size: 5210, limit: 5 }}
            onWarning={(type, rules) => {
                switch (type) {
                    case 'accept':
                        setState({
                            ...state,
                            msg: `Only ${rules.accept.join(', ')}`
                        })
                        break;
                    case 'size':
                        setState({
                            ...state,
                            msg: 'File size is over 5MB!'
                        })
                        break;
                    case 'limit':
                        setState({
                            ...state,
                            msg: 'Only 5 files at a time!'
                        })
                        break;
                    default:
                }
            }}
        />
        <h1>{state.msg}</h1>
        </>
m-inan commented 3 years ago

@Ahmadh26 Can you post any errors you received in the Console? And can you make a sample in CodeSandbox?

Ahmadh26 commented 3 years ago

@Ahmadh26 Can you post any errors you received in the Console? And can you make a sample in CodeSandbox?

I managed to fix it when I changed this:

Source={response => response.source}

To

Source={response => response}