Hi all,
My client is Win 7 Enterprise edition, application running on Windows 2003 with ASP 2.0 (webhosting).
It used to work fine for a long time, but not working since last updates.
Your suggestion to updgrade Silverlight to 4.0 version might a workaround for me (if it will help) but not for users running my application. I cannot force them to do it.
I tryied to remove my own InsertButtonID, but it doesnt work as well.
Here you have the full code:
Remark: Portal:ImageButton is my overriden standard ImageButton, just couple more functionality.
<div class="relative">
<script language="javascript" type="text/javascript">
var filesUploader = "<%=Me.cwFilesUploader.ClientID() %>";
</script>
<div id="queuediv" class="pad-b-15" style="display:none;" align="center">
<div id="queuedivtablecontainer" ></div>
</div>
<div id="upload-buttons" align="right">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="pad-r-50"></td>
<td><asp:ImageButton runat="server" ID="buttonChooseFiles" ImageUrl="~/images/ImageButtons/choose-files.png" /></td>
<td id="td-start-upload" style="display:none;"><Portal:ImageButton runat="server" ID="buttonStartUpload" ImageFileName="upload-to-server.png" OnClientClick="BLOCKED SCRIPTreturn submitbutton_click();" /></td>
</tr>
</table>
<div style="display:none;">
<asp:Button runat="server" ID="buttonCancelUpload" />
</div>
</div>
<div align="center">
<CuteWebUI:UploadAttachments runat="server"
ID="cwFilesUploader"
CancelButtonID="buttonCancelUpload"
InsertButtonID="buttonChooseFiles"
ManualStartUpload="true"
ProgressTextTemplate="%SEND% z %SIZE% přeneseno, rychlost %KBPS%"
ProgressPanelWidth="600">
</CuteWebUI:UploadAttachments>
</div>
<script language="javascript" type="text/javascript" src="../scripts/file-uploader.js"></script>
</div>
Script from file-uploader.js file:
var uploader = document.getElementById(filesUploader);
uploader.handlequeueui = myqueueuihandler;
function myqueueuihandler(list) {
if (list.length < 1) {
document.getElementById("queuediv").style.display = "none";
document.getElementById("td-start-upload").style.display = "none";
}
else {
document.getElementById("queuediv").style.display = "";
document.getElementById("td-start-upload").style.display = "block";
var container = document.getElementById("queuedivtablecontainer");
container.innerHTML = "";
var table = document.createElement("table");
table.cellSpacing = 0;
table.cellPadding = 0;
table.className = "table-uploader";
var trow = table.insertRow(-1);
var tcell;
trow.className = "thead";
tcell = trow.insertCell(-1);
tcell.innerHTML = "Název souboru";
tcell.align = "center";
tcell = trow.insertCell(-1);
tcell.innerHTML = "Velikost";
tcell.align = "right";
trow.insertCell(-1).innerHTML = " ";
for (var i = 0; i < list.length; i++) {
var name = list[i].FileName
var size = list[i].FileSize // (or -1)
var stat = list[i].Status // Finish|Error|Upload|Queue
var func = list[i].Cancel;
var row = table.insertRow(-1);
var x = row.insertCell(-1);
x.width = 300;
x.innerHTML = name;
x.align = "left";
var sz = row.insertCell(-1);
sz.width = 100;
sz.align = "right";
sz.innerHTML = parseInt(size / 1000) + " kB";
var last = row.insertCell(-1);
last.align = "center";
last.width = 80;
if (stat == "Queue") {
var btn = document.createElement("A");
btn.href = "BLOCKED SCRIPTdeleteAttachement();";
btn.onclick = func;
btn.innerHTML = "smazat";
last.appendChild(btn);
}
else if (stat == "Upload") { last.innerHTML = "nahrávám"; }
else if (stat == "Finish") { last.innerHTML = "OK"; }
else { last.innerHTML = "! chyba !"; }
}
container.appendChild(table);
}
return false; //hide the default;
}
function submitbutton_click() {
var submitbutton = document.getElementById(buttonStartUpload);
var uploadobj = document.getElementById(filesUploader);
document.getElementById("upload-buttons").style.display = "none";
if (!window.filesuploaded) {
if (uploadobj.getqueuecount() > 0) {
uploadobj.startupload();
}
else {
var uploadedcount = parseInt(submitbutton.getAttribute("itemcount")) || 0;
if (uploadedcount > 0) { return true; }
alert("Please choose files for upload");
}
return false;
}
window.filesuploaded = false;
return true;
}
function CuteWebUI_AjaxUploader_OnPostback() {
window.filesuploaded = true;
var submitbutton = document.getElementById(buttonStartUpload);
submitbutton.click();
return false;
}
function deleteAttachement() {
var uploadobj = document.getElementById(filesUploader);
if (uploadobj.getqueuecount() < 1) {
}
}
David Skowronek