Hi
I have a nice ltlle problem I hope to fin a sulution in JS and I will be werry thankfull if you guys coud help me out. ( Allso the newborn princess Estelle of Sweden will be pleased. The application I’m working on is for her )
I have a form that will take an image submitted by the user in a common way <input type=”file” name=”uploadFile”> an present i on a wp-blog.
Now I whant the form to take a base64 encoded image crated by javascript and add it to the form insted of an image subbitted by the user. Is the possible to do in javascript
Here is some example code
[FONT=”Courier New”]<html >
<head>
<title>post drawing</title>
</head>
<body>
<form enctype=”multipart/form-data” method=”post” action=”
<input type=”text” name=”displayName”>
<textarea name=”freetext”></textarea>
<a href=”javascript:{}” onclick=”postDrawing(); return false;” >Send</a><
</form>
<script>
function postDrawing()
{
base64Image_string = “data:image/png;base64,iVBORw0KGgo … etcetra etcetra … “;
var myform = document.getElementById(‘myform’);
/* here i whant to add the image in the var base64Image_string to the form as an input type file (<input type=”file” name=”uploadFile”>)
myform.submit();
}
</script>
</body>
</html>[/FONT]