You cannot access instance members from static members so you have 2 choices.
1. Make the method an instance method (remove the static keyword)
2. Make the field (i.e. FileUpload2) a static (add the static keyword)
The one you choose will depend on whether the field should be shared across all instances or not.
More information about static :
http://www.dotnetperls.com/static-field[
^]
UPDATE
HTML
<input type="file" name="file_upload" id="file_upload" />
Javascript
$(function() {
$("#file_upload").uploadify({
'fileSizeLimit' : '50KB',
'swf' : '/uploadify/uploadify.swf',
'uploader' : '/uploadify/uploadify.php',
'onSelectError' : function() {
alert('The file ' + file.name + ' returned an error and was not added to the queue.');
}
});
});
For more info check this :
http://www.uploadify.com/documentation/uploadify/onselecterror/[
^]
UPDATE 2
onError: function (event, queueId, fileObj, errorObj) {
$("#msg").html(fileObj.name + " was not uploaded ");
if (errorObj.status == 404)
$("#msg").html("Could not find upload script. Use a path relative to: " + "<?= getcwd() ?>");
else if (errorObj.type === "HTTP")
$("#msg").html("error " + errorObj.type + ": " + errorObj.status);
else if (errorObj.type === "File Size")
$("#msg").html(fileObj.name + " " + errorObj.type + " Limit: " + errorObj.info / 1000 + " KB");
else
$("#msg").html("error " + errorObj.type + ": " + errorObj.text);
}
For more info :
http://stackoverflow.com/questions/11577868/mvc-3-uploadify-how-to-show-custom-error-message[
^]
Note : For this You can get error codes from the link I put
UPDATE section.
I hope this will help to you.