我将如何将cloudinary小部件数据传递到数据库?

时间:2019-04-18 18:42:19

标签: mysql node.js

我的应用程序上有cloudinary小部件,但我需要将数据保存到mysql数据库中。有人可以为我提供一个简单的解决方案吗?

除了设置数据库之外,我真的不知道我在做什么。我的项目团队已经完成了其他所有工作,而我确实需要这一工作。

<script type="text/javascript">
        var userImage;
        var myWidget = cloudinary.createUploadWidget({
            cloudName: 'dushe8phr',
            uploadPreset: 'pzuiyhku'
        }, (error, result) => {
            if (!error && result && result.event === "success") {
                console.log('Done! Here is the image info: ', result.info.url);
                userImage = result.info.url;

                if (result.event === "success") {

                    let publicId = result.public_id;
                    let thumbnailUrl = result.thumbnail_url;
                    let url = result.url;

                    //send image info to our database

                }


            }
            document.getElementById("userphoto").setAttribute("src", userImage);
        }
        )

        document.getElementById("upload_widget").addEventListener("click", function () {
            myWidget.open();
        }, false);

    </script>

I was hoping to take that cloudinary data save in in my usersPictures row in my DB.

0 个答案:

没有答案