-1

I have a form with an input[type=file].I need to read the image from that input into a variable/object.and possibly convert it into a base64 string.

Cœur
  • 34,719
  • 24
  • 185
  • 251

1 Answers1

0

Why don't you do this with ColdFusion and return the Base64 to JS?

After uploading the image from your form:

<cfset imgObj = imageRead(imgFilePathWhereYouSavedTheUpload)>
<cfset binaryImage = toBase64(imgObj)>

<script>
<cfoutput>#ToScript(binaryImage, javascriptvar)#</cfoutput>
</script>
CFMLBread
  • 544
  • 2
  • 7