Why isn't uploadify and asp.net mvc 2 playing well for me?
First of all I checked all SO threads and searched my brains out. I must be missing something obvious. I would really appreciate help! This is what I have.
UploadController.cs
using System.Web;
using System.Web.Mvc;
namespace NIMDocs.Controllers
{
public class UploadController : Controller
{
public ActionResult Index()
{
return View();
}
public string Processed(HttpPostedFileBase FileData)
{
// DO STUFF
return "DUHR I AM SMART";
}
}
}
Index for loading
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>ITS A TITLE </title>
<script src="../../Content/jqueryPlugins/uploadify/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="../../Content/jqueryPlugins/uploadify/swfobject.js" type="text/javascript"></script>
<script src="../../Content/jqueryPlugins/uploadify/jquery.uploadify.v2.1.0.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#uploadify').fileUpload({
'uploader': '../../Content/jqueryPlugins/uploadify/uploadify.swf',
'script': '/Upload/Processed',
'folder': '/uploads',
'multi': 'true',
'buttonText': 'Browse',
'displayData': 'speed',
'simUploadLimit': 2,
'cancelImg': '/Content/Images/cancel.png'
});
});
</script>
</head>
<body>
<input type="file" name="uploadify" id="uploadify" />
<p><a href="javascript:jQuery('#uploadify').uploadifyClearQueue()">Cancel All Uploads</a></p>
</body>
</html>
What am I missing here? I've tried almost every permutation of the path to add the "uploader" option. Absolute path, prefixed '/', etc.
This is what I see.

And here is the directory structure.

+2
a source to share
3 answers
You have pronounced Processed Procssed and hence you will not hit 'script': '/ Upload / Processed',
Edit
public string Procssed(HttpPostedFileBase FileData)
{
// DO STUFF
return "DUHR I AM SMART";
}
to
public string Processed(HttpPostedFileBase FileData)
{
// DO STUFF
return "O SMART ONE HAS SPOKEN";
}
EDIT
Remove the jquery script code block and your html input and use this code instead
<body>
<input id="fileInput" name="fileInput" type="file" />
<script type="text/javascript">// <![CDATA[
$(document).ready(function () {
$('#fileInput').uploadify({
'uploader': '../../Content/jqueryPlugins/uploadify/uploadify.swf',
'script': '/Upload/Processed',
'cancelImg': 'cancel.png',
'auto': true,
'folder': '/uploads'
});
});
// ]]>
</script>
</body>
+4
a source to share