Skip to content
Snippets Groups Projects
Commit a8382a86 authored by Jeffry's avatar Jeffry
Browse files

Moved upload.js to edit.js

parents 440636e9 0d7ab47b
Branches
No related merge requests found
window.onload = function() {
var input = document.getElementById('field_data');
var infoArea = document.getElementById('filename');
var image = document.getElementById('prof_pic');
input.addEventListener('change', function ( event ) {
// the change event gives us the input it occurred in
var input = event.srcElement;
// the input has an array of files in the `files` property, each one has a name that you can use. We're just using the name here.
var fileName = input.files[0].name;
// use fileName however fits your app best, i.e. add it into a div
infoArea.value = fileName;
var imagePath = URL.createObjectURL(event.target.files[0]);
image.src = imagePath;
});
}
\ No newline at end of file
......@@ -23,7 +23,6 @@
css("edit_biodata.css");
js("bootstrap.js");
js("edit.js");
js("upload.js");
?>
<!-- <link rel="stylesheet" href="assets/css/edit_biodata.css">
<script src="assets/js/edit.js"></script> -->
......@@ -51,8 +50,9 @@
alt="Profile Picture"> </td>
<td>
Update profile picture <br>
<input type="text" id="filename" class="fieldname" readonly></div>
<input id="field_data" name="image" type="file" accept="image/jpg|image/png" class="inputfile"/><label for="field_data">Browse...</label>
<input type="text" id="filename" class="fieldname" readonly>
<input id="field_data" name="image" type="file" accept="image/jpeg, image/png, image/gif" class="inputfile"/><label for="field_data">Browse...</label>
<!-- <input type="text" id="filename" class="fieldname" name="pic_id" value="<?php echo $data["pic_id"]?>"></div> -->
<!-- <form action="ajax/image/set" method="POST" id="prof_pic_form">
<input id="field_data" name="data" type="file" accept="image/jpg|image/png" class="inputfile"/><label for="field_data">Browse...</label>
</form> -->
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment