Edit: If this helped you and you want to repay the favor...
Vote for my wifes photo contest entry HERE
WATCH THIS TUTORIAL IN HD!
Here is a 15 minute explaination of how to use an Uploadify control in an ASP.Net application, using C#. It is a complete walkthrough, from downloading uploadify and opening VS2008 Web Express to setting some of the advanced uploadify options.
Instead of the Upload.php handler that is shown in the Uploadify examples online, we use a Generic Handler, Upload.ashx, to handle our upload logic.
It seems really easy to do in retrospect, but when you are sitting there with no example using your set of tools, it can be frustrating. Enter this video.
The following is the code I promised:
Uploadify Control:
<script type="text/javascript">
// <![CDATA[
var id = "55";
var theString = "asdf";
$(document).ready(function() {
$('#fileInput').uploadify({
'uploader': 'uploadify/uploadify.swf',
'script': 'Upload.ashx',
'scriptData': { 'id': id, 'foo': theString},
'cancelImg': 'uploadify/cancel.png',
'auto': true,
'multi': true,
'fileDesc': 'Image Files',
'fileExt': '*.jpg;*.png;*.gif;*.bmp;*.jpeg',
'queueSizeLimit': 90,
'sizeLimit': 4000000,
'buttonText': 'Choose Images',
'folder': '/uploads',
'onAllComplete': function(event, queueID, fileObj, response, data) {
}
});
});
// ]]></script>
<input id="fileInput" name="fileInput" type="file" />
Upload.ashx
public class Upload : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
try
{
HttpPostedFile file= context.Request.Files["Filedata"];
int id = (Int32.Parse(context.Request["id"]));
string foo = context.Request["foo"];
file.SaveAs("C:\\" + id.ToString() + foo + file.FileName);
context.Response.Write("1");
}
catch(Exception ex)
{
context.Response.Write("0");
}
}
}