How to access scriptData from boot in asp.net MVC controller

Hi guys, I uploaded the handling of some file uploads to my mvc project, and this part works very well, I just want to know what I will need to add to my controller action in order to access the scriptData variables that I switch from downloadable javascript

EDIT for a more detailed explanation:

my uploadify script looks like this:

var fileCategoryID; $(document).ready(function() { $('#uploadify').uploadify({ 'uploader': '../../scripts/uploadify.swf', 'cancelImg': '../../content/images/cancel.png', 'script': '../../' + $('#Controller').val() + '/FileSave/' + $('#OrderID').val(), 'folder': 'Uploads', 'multi': true, 'auto': false, 'queueSizeLimit': 5, 'queueID': 'fileQueue', 'displayData': 'speed', 'fileExt': '*.pdf', 'fileDesc': 'PDF', 'sizeLimit': '5242880', 'scriptData': { 'categoryID': fileCategoryID } }); $('#fileCategory').change(function() { fileCategoryID = $('#fileCategory').val(); }); }); 

I am curious how I can access this data from my controller action

+6
asp.net-mvc uploadify
source share
2 answers

I found an answer that works through it myself, having accepted a formcollection in my controller action, I can access the categoryID parameter from the uploadify script.

EDIT for some code:

  [AcceptVerbs(HttpVerbs.Post)] public string FileSave(long id, HttpPostedFileBase FileData, FormCollection forms) { long catID = Int64.Parse(forms.Get("CategoryID")); //do something with files return "Upload Successful"; } 
+4
source share
 <script type="text/javascript"> $(function () { $('#file_upload').uploadify({ 'swf': "@Url.Content("~/Content/UploadifyContent/uploadify.swf")", 'cancelImg': "@Url.Content("~/Content/UploadifyContent/uploadify-cancel.png")", 'uploader': "@Url.Action("Upload", "Callout", new { @id = 5 })", 'scriptData': { 'id': $('#Job_Id').val() }, 'onUploadSuccess': function (file, data, response) { $("#uploaded").append("<img src='" + data + "' alt='Uploaded Image' />"); } }); }); </script> 

public ActionResult Upload (long identifier, HttpPostedFileBase FileData) {

}

replace '5' with $ ('# /. blah'). val () or equiv

0
source share

All Articles