I use a small file upload dialog to show some images.
$("document").ready(function () {
$("#dialogImageUpload").change(function (input) {
$(input.target.files).each(function (imageIndex, currentImage) {
if (currentImage.type.match('image.*')){
alert(currentImage.name);
}
});
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="file" id="dialogImageUpload" multiple>
<div id="ImageListContainer"></div>
So you can read the name of the currentImage
. How can I get the full path from it?
For example
var uploadedImage = $("<div><img src= theFilePath /></div>");
The second question I have is when using the file dialog, the change
event obviously gets triggered if different files are selected as before. But what if I want to upload a file twice? The change
event is not triggered anymore. Can I solve this somehow?