Link to home
Start Free TrialLog in
Avatar of team2005
team2005

asked on

How to save picture tacen from mobilen camera to my server

Hi!

I am using HTML5, and have testet this code:

<input id="file-input" type="file" name="image" accept="tor/*" capture="camera" />

Its working fine, but i need to store the filename to my database
and the picture to my server.

Onother thing is that -> <input id="file-input" type="file" name="image" accept="tor/*" capture="camera" />
Gives me a button on mobile, how to use own button for this ?
ASKER CERTIFIED SOLUTION
Avatar of mcnute
mcnute
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of team2005
team2005

ASKER

Hi!

This code i find is good. But the image is not stored on my server ?

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>HTML5 camera test</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<form>
<input id="file-input" type="file" name="image" accept="image/*" capture="camera" />
</form>
<pre id="output"></pre>
 
<script>
var input = document.getElementById("file-input");
input.addEventListener("change", function(event) {
var file = input.files[0],
img = new Image(),
reader = new FileReader();
 
document.getElementById("output").innerHTML =
file.name + "\n" +
file.type + "\n" +
file.size + " bytes\n";
 
reader.onload = function(event) {
var img = new Image();
img.width = 300;
img.src = event.target.result;
document.body.appendChild(img);
};
reader.readAsDataURL(file);
}, false);
</script>
</body>
</html>

Open in new window

Hi!

Is this not possible ?
thanks