最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - Is it possible to upload files via Ajax? - Stack Overflow

programmeradmin1浏览0评论

I want to build a file manager for my ASP.NET MVC app and am curious if it's possible to upload files via ajax. I heard it was not possible and that you had to use flash.

So far in my travels I stumbled upon this demo:

It looks like a pretty solid file uploader that uses jQuery. Does this use flash at all to acplish its goal? What are your opinions on the plugin I just linked?

I have heard a lot about Uploadify, would that be a better choice?

Sorry, I'm new to the file uploading arena.

I want to build a file manager for my ASP.NET MVC app and am curious if it's possible to upload files via ajax. I heard it was not possible and that you had to use flash.

So far in my travels I stumbled upon this demo: http://aquantum-demo.appspot./file-upload

It looks like a pretty solid file uploader that uses jQuery. Does this use flash at all to acplish its goal? What are your opinions on the plugin I just linked?

I have heard a lot about Uploadify, would that be a better choice?

Sorry, I'm new to the file uploading arena.

Share Improve this question edited May 23, 2017 at 12:13 CommunityBot 11 silver badge asked Apr 15, 2011 at 23:09 ChevCastChevCast 59.3k66 gold badges221 silver badges325 bronze badges 1
  • Are there no opinions on the aquantum demo file upload? – ChevCast Commented Apr 15, 2011 at 23:23
Add a ment  | 

5 Answers 5

Reset to default 3

The answer to your question is no but there are jquery plugins that allow you to achieve this using an iframe behind the scenes.

No, but you could embed an iframe. This solution will look like uploading a file using AJAX (without refreshing the page).

You can use the HTML5 file API (If your using a petent browser).

var reader = new FileReader();

reader.readAsBinaryString(file);

reader.onload = function(string) {
    $.post(url, string, function() {
         // success
    }); 
};

You can use Uploadify, as you suggest, or ajaxupload, which is also a good choice. I use them both, and they are both good ponents.

in regards to ajax, the answer is no, the JavaScript framework does not support uploading files, although this is something to look out for in the future of HTML5, Sockets and Binary FileReaders etc.

For the mean time you can use a flash uploader, this would allow you to upload a file without changing the context of the page.

it will also allow you to interact with the web page, so when the file is uploaded you can then send a mand to the page to execute a java script function, in turn would modify the page itself.

i would look at Uploadify which uses a flash up loader and was designed to be fully interactive with jQuery.

发布评论

评论列表(0)

  1. 暂无评论