-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
  • 37,241
  • 25
  • 195
  • 267

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
  • 734
  • 3
  • 7