如何将文件发送到使用JSON和jQuery的服务器 [英] How to send a file to a server using JSON and jQuery

查看:149
本文介绍了如何将文件发送到使用JSON和jQuery的服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经到使用jQuery将文件发送到我的服务器。我怎样才能做到这一点使用JSON?

I've to send a file to my server using jQuery. How can I do it using JSON?

文件类型并不重要,我打算接受我的服务器应用程序ByteArray或类似的东西。

The file type is not important, I intend to receive a byteArray or something like that on my server application.

如果它有助于我使用ASP.NET应用程序,但我的问题是不是我处理上服务器端,问题是如何使用jQuery发送文件数据的方式。

If it helps I'm using an ASP.NET application, but my problem is not the way I handle that on server side, the issue is how to send the file data using jQuery.

我已经找到了jQuery的一些插件上传使用Flash文件,别人不使用Flash,但是我真正想知道的是这个过程是如何工作的,不只是使用已经有人创建了什么!

I've found some upload plugins for jQuery that use a Flash file, others that do not use Flash, but what I really want to know is how the process works, not just use something already created by someone!

推荐答案

jQuery是JavaScript的。我想你的意思是通过Ajax无法完成发送数据。你能做的最好的事情就是使用iframe的文件上载到一个临时目录(而不是默认的临时)页面,然后提供信息反馈给父页面以该文件被保存,那么你使用它

jQuery is JavaScript. I think you mean to send the data via Ajax which can not be done. The best thing you can do is to use an iframe to a page that uploads the file to a temporary directory (not the default temp), and then provides the information back to the parent page as to where the file is saved then you use it.

有没有办法上传文件使用Ajax的服务器。这太不安全。

There is no way to upload a file to a server using Ajax. It's too insecure.

我收回上述现声明

您现在可以使用JavaScript它是一个新手,了解非常复杂,但现在是可能的,当这个问题得到回答不像发布/下载文件日期

You are now able to post / download file date using Javascript it's very complicated for a novice to understand but is now possible unlike when this question was answered

<一个href=\"http://stackoverflow.com/questions/4006520/using-html5-file-uploads-with-ajax-and-jquery\">Using HTML5文件上传AJAX和jQuery

这篇关于如何将文件发送到使用JSON和jQuery的服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆