I am looking for the code that can help me in getting the original path(not fake path) of the image that has to be uploaded from the client machine.As many browsers doesn't provide the path due to some security issues.
Here is my html code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="js\ajax_jquery_jquery-1_9_0.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
function valueCheck() {
//alert ur fileupload control value
var path = document.getElementById("file").value;
//alert(document.getElementById("file").value);
alert(" PATH " + path);
//check for other controls value
var icon_elem = document.getElementById("img");
icon_elem.src = path;
display();
}
function display() {
$.ajax({
type: 'POST',
url: 'xidirectorywebservice.asmx/UploadImage',
data: "{ }",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (image_string) {
var data = 'data:image/png;base64,' + image_string.d;
var icon_elem = document.getElementById("ItemPreview");
icon_elem.src = data;
},
error: function () {
alert("Error");
}
});
}
</script>
</head>
<body>
<br />
<img id="ItemPreview" src="" />
<label for="file">Filename:</label>
<input type="file" name="file" id="file"/><br/>
<input type="submit" name="submit" value="Submit" onclick="valueCheck()" />
</body>
</html>
The above code has two buttons choose file which is used to choose the image from the client machine and submit button which checks the path of the image(we are getting the fake path here) as we need to pass it to the web service in order to save it in database.
After a long struggle i realized that i cannot get the path using the client side code, and have got no idea how to extract this path using vb.net web service can any one help me with this?
cheers.