I have a problem using blueimp file upload in vb.net. I implemented it that way:
sb.Append("<div id='fileupload'>" & _
"<form method='POST' enctype='multipart/form-data'>" & _
"<div class='fileupload-buttonbar'>" & _
"<label class='fileinput-button'>" & _
"<span>Add files...</span>" & _
"<input id='file' type='file' name='files[]' multiple>" & _
"</label>" & _
"<button type='submit' class='start'>Start upload</button>" & _
"<button type='reset' class='cancel'>Cancel upload</button>" & _
"<button type='button' class='delete'>Delete files</button>" & _
"</div>" & _
"</form>" & _
"<div class='fileupload-content'>" & _
"<table class='files'></table>" & _
"<div class='fileupload-progressbar'></div>" & _
"</div>" & _
"</div>")
All fileupload.js'es are linked well. But after selecting a file no thumbnail is shown. I tried using that asp.net example from here.
When I call the index.html everything goes well. If I try using it within my vb.net project no thumbnail is shown.
Any ideas would be appreciated.
Edit: My source looks like this:
<div id="fileupload">
<form method="POST" enctype="multipart/form-data">
<div class="fileupload-buttonbar">
<label class="fileinput-button"><span>Add files...</span>
<input id="file" type="file" name="files[]" multiple=""></label>
<button type="submit" class="start">Start upload</button>
<button type="reset" class="cancel">Cancel upload</button>
<button type="button" class="delete">Delete files</button>
</div>
</form>
<div class="fileupload-content">
<table class="files"></table><div class="fileupload-progressbar">
</div>
</div>
</div>
Edit 2: It seems like something overrides the "add" function. If I use the example index.html from downloaded .zip I can console.log the add. In my vb.net project I cant... Does someone has an idea how to find out which file is overriding that one?
I got it working now!
The problem was that this reference was not working for me:
<script type="text/javascript" src="http://blueimp.github.com/JavaScript-Templates/tmpl.min.js"></script>
With this one it works like a charm:
downloadTemplate: function (o) {
var rows = $();
$.each(o.files, function (index, file) {
var row = $('<tr class="template-download fade">' +
(file.error ? '<td></td><td class="name"></td>' +
'<td class="size"></td><td class="error" colspan="2"></td>' :
'<td class="preview"></td>' +
'<td class="name"><a></a></td>' +
'<td class="size"></td><td colspan="2"></td>'
) + '<td class="delete"><button>Delete</button> ' +
'<input type="checkbox" name="delete" value="1"></td></tr>');
row.find('.size').text(o.formatFileSize(file.size));
if (file.error) {
row.find('.name').text(file.name);
row.find('.error').text(
locale.fileupload.errors[file.error] || file.error
);
} else {
row.find('.name a').text(file.name);
if (file.thumbnail_url) {
row.find('.preview').append('<a><img></a>')
.find('img').prop('src', file.thumbnail_url);
row.find('a').prop('rel', 'gallery');
}
row.find('a').prop('href', file.url);
row.find('.delete button')
.attr('data-type', file.delete_type)
.attr('data-url', file.delete_url);
}
rows = rows.add(row);
});
return rows;
}