Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It's not possible with pure ASP.NET.</p> <p>You need to take JQuery uploadify. It's the best you can find, trust me, I tried for an entire day.</p> <pre><code>&lt;%@ Page Language="vb" AutoEventWireup="false" CodeBehind="MassUpload.aspx.vb" Inherits="Raumplaner_New.MassUpload" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head id="Head1" runat="server"&gt; &lt;title&gt;Mass Upload&lt;/title&gt; &lt;link href="../upload/css/uploadify.css" rel="stylesheet" type="text/css" /&gt; &lt;script type="text/javascript" src="../scripts/jquery-1.3.2.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="../scripts/swfobject.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="../scripts/jquery.uploadify.v2.1.0.min.js"&gt;&lt;/script&gt; &lt;script type = "text/javascript"&gt; $(document).ready( function() { $("#&lt;%=FileUpload1.ClientID%&gt;").uploadify({ 'uploader' : '../upload/scripts/uploadify.swf', 'script' : '../cgi-bin/Upload.ashx', 'cancelImg' : '../upload/images/cancel.png', 'folder' : '../upload/temp', 'buttonImg' : '../upload/images/uploadbutton.png', 'width' : '97', 'height' : '22', 'wmode' : 'transparent', 'displayData' : 'speed', 'multi' : true, 'auto' : true, 'simUploadLimit' : 20, 'fileDesc' : 'DWG und SWF - Dateien', 'fileExt' : '*.dwg;*.swf', 'onSelect' : function(event, queueID, fileObj){ EnableObject('FileUpload1');}, 'onCancel' : function(event, queueID, fileObj, data){DisableObject('FileUpload1');}, 'onComplete' : function(event,queueID,fileObj,response,data){alert(fileObj.name);} }); $("#startUploadLink").click( function() { $('#&lt;%=FileUpload1.ClientID%&gt;').uploadifyUpload(); return false; }); $("#clearQueueLink").click( function() { $("#&lt;%=FileUpload1.ClientID%&gt;").uploadifyClearQueue(); return false; }); }); &lt;/script&gt; &lt;/head&gt; &lt;body style='background:black;'&gt; &lt;div id='main'&gt; &lt;form id="form1" runat="server"&gt; &lt;br/&gt; &lt;div class="demo"&gt; &lt;asp:FileUpload ID="FileUpload1" runat="server" /&gt; &lt;br /&gt; &lt;a href="#" id="startUploadLink"&gt;Start Upload&lt;/a&gt;&amp;nbsp; |&amp;nbsp; &lt;a href="#" id="clearQueueLink"&gt;Clear&lt;/a&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>And here's upload.ashx &lt;%@ WebHandler Language="VB" Class="Upload" %></p> <pre><code>Imports System Imports System.Web Public Class Upload : Implements IHttpHandler Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest Dim postedFile As HttpPostedFile = context.Request.Files("Filedata") Dim savepath As String = "" Dim tempPath As String = "" tempPath = context.Request("folder") 'If you prefer to use web.config for folder path, uncomment below: 'tempPath = System.Configuration.ConfigurationManager.AppSettings("FolderPath") savepath = context.Server.MapPath(tempPath) Dim filename As String = postedFile.FileName If Not System.IO.Directory.Exists(savepath) Then System.IO.Directory.CreateDirectory(savepath) End If postedFile.SaveAs((savepath &amp; "\") + filename) context.Response.Write((tempPath &amp; "/") + filename) context.Response.StatusCode = 200 End Sub Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable Get Return False End Get End Property End Class </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload