简体   繁体   中英

Download an image to my server form data URL

I am developing a site as a student project, in which you're supposed to login > take a picture with your camera > display all the pictures ever taken > like and comments picture.

I already have that piece of Javascript which draw an image on a canvas from the camera stream. Then it sets a new element and set its 'src' attr to canvas.toDataURL(img/png); to display a preview for the pic just taken.

Now what I want, and can't find a solution for, is saving this new created picture to my server on a /img/photo1.png directory OR stock a link on the database that I can output later.

Thanks for helping.

(BTW, I'm not allowed to use any library (no JQuery please !!))

好的,我找到了我的答案,我不明白的是您可以(几乎)直接在字符串 canvas.toDataURL(img/png) 返回上使用 file_put_contents (php) !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM