Hi, I've tried this small script:
Code:
<!-- image preview -->
<script language="javascript">
var imgRe = /^.+\.(jpg|jpeg|gif|png)$/i;
function previewImage(pathField, previewName) {
console.log(pathField.value);
var path = pathField.value;
if (path.search(imgRe) != -1) {
document[previewName].src = 'file://'+path;
console.log( 'file://'+path);
} else {
alert("JPG, PNG, and GIFs only!");
}
}
</script>
but the var path contains only "picture1.png" instead of the complete path "User/Desktop/Picture1.png".