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.
Asked
Active
Viewed 42 times
-1
-
http://stackoverflow.com/questions/6978156/get-base64-encode-file-data-from-input-form – Matt Busche Aug 18 '16 at 11:38
1 Answers
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