I am implementing Uploadify to upload files to a server which works perfectly. but i have come into some problems when i want to write the response to the a model in my view...
Lets say i have a customer model with a headshot field that i want to populate with the response from the Uploadify 'oncomplete' event...
whats the best practice to do something like this.. I'm quite new to web dev so i've found myself very lost trying to figure this out..
cheers in advance for any help
If I am understanding you correctly, you want to populate the model from the 'successful' response from uploadify callback?
What I usually do is:
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);
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.