jQuery UI Widgets › Forums › Editors › FileUpload › use jqxFileUpload with MVC Controller or API Controller ?
Tagged: API, asp .net mvc, asp.net, file, File Upload, fileupload, jqxFileUpload, MVC, upload
This topic contains 5 replies, has 3 voices, and was last updated by Dimitar 7 years, 2 months ago.
-
Author
-
Hi
i need to use nice jqxFileUpload in my MVC project but i didn’t find any code for that explain how to use MVC Controller or API Controller to upload file and create directories if needed in your documentation ?
so please can you provide full example for that ?
Hi ahmed.mo.amin,
Unfortunately, we do not have such an example. Please note, however, that the upload with jqxFileUpload is no different than uploading with a file input inside a form. The property uploadUrl corresponds to the form’s action attribute and the property fileInputName corresponds to the file input’s name attribute. You can read more about these properties, and others, in the jqxFileUpload API Documentation.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Thanks
are that mean i can set uploadUrl to be from actionresult in any controller i need ?
I try it as
public ActionResult Upload(HttpPostedFileBase[] fileToUpload) { foreach (HttpPostedFileBase File in fileToUpload) { var path = Path.Combine(Server.MapPath("~/Uploads/"), File.FileName); File.SaveAs(path); } return View(); }
and set js code as:
$(document).ready(function () { $('#jqxFileUpload').jqxFileUpload({ width: '100%', browseTemplate: 'success', uploadTemplate: 'primary', cancelTemplate: 'danger', uploadUrl: "@Url.Content("~/Uploader/Upload")", fileInputName: 'fileToUpload', localization: { browseButton: 'Select File' } });
and it works great
Thanks a lot
hi Team
Could you pls provide below example
my requirement is jqxfileupload to upload image i need to show preview in same page and save image in sql server db
Thanks
Hi omkar,
You can upload images using jqxFileUpload. This widget has the same upload capability as the standard HTML input type=”file”. Unfortunately, we cannot provide you with solutions on image preview and saving to database, because these are not directly related to our widget, but to the general operation of uploading in HTML/JavaScript.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.