I was a little confused with jQuery-File-Upload myself, but after reviewing the plugin documentation I found what is needed for the plugin to work on Windows environment.
PROBLEM 1: FILE SAVING - regarding this issue, make sure that you are saving to a valid and previously created directory, and also that you have WRITE permissions to that directory.
PROBLEM 2: UPLOAD POSTBACK - You must setup your upload script to write the uploaded file, AND return a valid JSON response to the plugin, as defined on the plugin documentation:
if (context.Request.Files.Count > 0) { HttpFileCollection files = context.Request.Files; for (int i = 0; i < files.Count; i++) { HttpPostedFile file = files[i]; string fname = context.Server.MapPath("~/uploads/" + file.FileName); file.SaveAs(fname); } } upload_response = '{"files":[{"name": ' + file.FileName + '","size":' file.FileSize + ',"url":"http:\/\/example.org\/files\/ + file.FileName + ",' upload_response =+ '"thumbnailUrl": "http:\/\/example.org\/files\/thumbnail\/ + file.FileName + ","deleteUrl": "http:\/\/example.org\/files\/ + file.FileName + ",' upload_response =+ '"deleteType": "DELETE"}]}"' context.Response.ContentType = "application/json"; context.Response.Write( upload_response );Please note that I also changed the ContentType to "application/json". The syntax of this code may not be complete, but the most important is to output these JSON fields required by the plugin.
Good Luck!
Ferdi
我有点困惑,jQuery文件上传自己,但在回顾我所发现的是插件工作在Windows环境下所需要的插件文件。
问题1:文件保存-关于这个问题,确保您保存到一个有效的和先前创建的目录,而且你要那个目录的写权限。
问题2:上传回你必须设置你的上传脚本写的上传的文件,并返回一个有效的JSON响应的插件,在插件文件定义:
if (context.Request.Files.Count > 0) { HttpFileCollection files = context.Request.Files; for (int i = 0; i < files.Count; i++) { HttpPostedFile file = files[i]; string fname = context.Server.MapPath("~/uploads/" + file.FileName); file.SaveAs(fname); } } upload_response = '{"files":[{"name": ' + file.FileName + '","size":' file.FileSize + ',"url":"http:\/\/example.org\/files\/ + file.FileName + ",' upload_response =+ '"thumbnailUrl": "http:\/\/example.org\/files\/thumbnail\/ + file.FileName + ","deleteUrl": "http:\/\/example.org\/files\/ + file.FileName + ",' upload_response =+ '"deleteType": "DELETE"}]}"' context.Response.ContentType = "application/json"; context.Response.Write( upload_response );请注意,我也改变了contentType“application/json”。此代码的语法可能不完整,但最重要的是输出这些领域所需的JSON插件。
祝你好运!
Ferdi