If I am understanding you correctly, you want to populate the model from the 'successful' response from uploadify callback?
What I usually do is:
- Upload the image using the uploadify plugin
- I have separate controller which uploadify talks to
- Save it, resize it, and maybe do other adjustments to the actual image itself on the server
- The server will return either a success message or failed message
- If a failed message is returned, the server returns the failed message, together with the error
- If a success message is returned, the server will return the success message together with the path of the image
- On the callback I will use jQuery to populate my models hidden field with the path of the image.
If you want an example, or if you have any other questions, just let me know.
Thanks
Tyrone
Edited ----------
Lets say I have a view which contains the following
@Html.HiddenFor(model => model.Media.Path, new { @id = "image-path" });
<input type="file" name="imageFile" id="file-upload" />
My script contains the following
$('#file-upload').uploadify({
'uploader': '/Scripts/Admin/uploadify/uploadify.swf',
'script': '/Admin/Media/UploadImage/',
'cancelImg': '/uploadify/cancel.png',
'auto': true,
'fileExt': '*.jpg;*.gif;*.png;*.pdf',
'sizeLimit': 202400000,
'onComplete': function (event, ID, fileObj, response, data) {
$("#image-path").val(response);
}
});