0

I have created thumbnail from mp4 video and displayed it on the same page by adding eventListener to video browse button. I want that when user will click on the save button the video as well as all the other fields should save in the database which is already working fine.

The problem is now that I am trying also to send the canvas image as normal input type=file.

For this I have two options in my mind:

  1. to save the canvas displayed image on client machine drive (html5 localstorage)
  2. Or I have to send the canvas image to the server and then have to upload that from the temp uploaded folder (I know this is a stupid idea).

What shall I try next?

halfer
  • 19,824
  • 17
  • 99
  • 186
Abdul Rahman
  • 1,669
  • 4
  • 24
  • 39
  • Read this question: [Uploading 'canvas' image data to the server](http://stackoverflow.com/questions/1590965/uploading-canvas-image-data-to-the-server) – S.A Feb 27 '16 at 09:48

1 Answers1

0

you dont have to assume canvas as a file. when you use canvas.toDataURL('image/png') on canvas.it return a base64 encoded string that represents an encoded URL.then you can send the string to server trough POST method.

in server side reconstruct the image from the base64 encoded string you sent from client.

Pavan Teja
  • 3,192
  • 1
  • 15
  • 22