Jupload with asp.net - 上传确认问题
问题就这么简单:
我使用 Jupload 在我的 ASP.NET Web 应用程序中上传文件。
我有“家庭作业”、“测验”和“考试”等文档类型,我需要上传文档并将其保存到文档表中使用这些类型之一和文件的路径。
但由于 jupload 不知道我的文档类型,因此当用户上传文档时,它只是将文件内容发布到我创建的页面上。在该接收页面中,我可以知道上传是否完成,但带有小程序的页面不知道这一点。
我尝试在接收页面中创建一个 successCompleted 事件,告诉我上传的文档已保存到磁盘,但我猜,因为这只是一个包含文件内容的帖子,所以带有小程序的页面仍然是当前显示的页面,并且没有Response.Redirect 在事件方法中工作。
我有一些想法;
- 我可以自定义小程序(jupload)**但我真的不想这样做,
- 我可以将文档临时保存到磁盘,将其信息保存在某处,并让最终用户在临时保存后选择文档类型。但是,这仍然意味着我需要从小程序获得上传完成的确认。
我洗耳恭听(或眼睛在这里).. 我将不胜感激对这个问题的任何想法。
如果这是一个我不知道的简单信息,我就准备好被羞辱了(:
The problem is this simple:
I use Jupload to upload files in my asp.net web application.
I have document types like "Homework", "Quiz" and "Exam" that I need to upload a document and save them to Document table with one of these types and the path of the file.
But since jupload doesn't know my document types, when a user uploads a document, it just posts the file content to a page I created. In that receiving page, I can know if the upload is complete but the page with the applet doesn't know that.
I tried to create a successfullyCompleted event in the receving page, tells me that the uploaded documents saved to disk but I guess, since this is just a post with the file contents, the page with the applet is still the current page that displays and no Response.Redirect is working in the event method.
I have some thoughts;
- I can customize the applet(jupload) **But I really don't want to do that
- I can temporarily save the documents to disk, keep their info somewhere and let the end user choose a document type after this temporary save. But, this still means that I need to get an acknowledgement from the applet that the upload is completed.
I'm all ears(or eyes here)..
I'll appreciate any thoughts on that problem.
If it is a simple information I'm not aware of, I'm ready to be humiliated(:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我实际上并没有使用过 jUpload,但是快速浏览一下 它的文档之一 显示了下面的小程序参数可能会提供您想要的内容:
参数:formdata
描述:使用此参数,可以指定 HTML 表单的名称。如果指定的表单与小程序一样存在于同一文档中,则所有表单变量都将作为 POST 参数添加到小程序的 POST 请求中。
您可以做的是让他们从上传的同一页面上的下拉列表中选择文档类型,然后它将与文件一起发布,以便您可以处理它。
我能看到的与 ASP.NET 相关的唯一问题是,通常整个页面都在表单标记内,这意味着页面上的所有表单字段都将与您的文件上传一起回发。这包括视图状态字段。可能不是问题(您可以忽略它们),除非那里有很多。
I haven't actually used jUpload, but a quick look in one of its docs shows the following parameter for the applet that might give you what you want:
Parameter: formdata
Description: With this parameter, the name of an HTML form can be specified. If the specified form exists in the same document like the applet, all form-variables are added as POST parameters to the applet's POST request.
What you could do is have them pick the document type from a dropdown on the same page as the upload, and then it would get posted along with the file so you can process it.
The only hiccup I can see with this in relation to asp.net, is that usually the whole page is inside the form tag, which means that ALL the form fields on the page would be posted back along with your file upload. That includes the viewstate fields. Might not be a problem (you can ignore them) unless there is a lot there.