ASP.NET 3.5 and above only

Obout.Ajax.UI Controls - File Upload - Upload images only

Here you can upload up to 10 MB of images on asynchronous postback.

(the following CheckBox doesn't effect on IE with version number less than 10)
Multiple selection:




ASP.NET
<%@ Register Assembly="Obout.Ajax.UI" Namespace="Obout.Ajax.UI.FileUpload" TagPrefix="obout" %>
<script type="text/JavaScript">
function onClientBeforeUpload(sender, args) {
   $get("<%= label.ClientID %>").innerHTML = ""
   return true;
}
// on checkbox changed
function multipleChanged() {
   // FileUpload component
   var fileUpload = $find("<%= fileUpload1.ClientID %>");
   // inner input (type="file") field
   var inputFile = $get(fileUpload.get_inputFile().id);
   // set/unset multiple selection
   inputFile.multiple = $get("checkbox").checked;
   $get("checkbox").checked ? inputFile.setAttribute("multiple", "true") : inputFile.removeAttribute("multiple");
}
// on page load
function pageLoad() {
   // test the checkbox 
   multipleChanged();
}
</script>
...
<asp:UpdatePanel runat="server" ID="UpdatePanel1"><ContentTemplate>
Multiple selection: <input type="checkbox" id="checkbox" checked="checked" onchange="multipleChanged()" />
<br /><br />
<obout:FileUpload OnClientBeforeUpload="onClientBeforeUpload" Accept="image/*""
       ValidFileExtensions="jpeg;jpg;gif;tiff;png" MaximumTotalFileSize="10240"
       Width="250px" runat="server" id="fileUpload1" BrowseFieldDescription="Images"
/>
<br /><asp:Button runat="server" ID="submit" Text="Upload files" /><br /><br />
<asp:Label runat="server" ID="label" Text="" />
</ContentTemplate></asp:UpdatePanel>

"I love your asp.net components and they help me a great deal. Thank you so much to obout and it's developers! you guys make our life a lot easier and fun to do coding. "

Shwe Phyo Khun

Random testimonial   All testimonials