如何在 asp.net 中使用 Yahoo uploader 小部件上传文件
许多人可能有使用 Yahoo 用户界面库
中的文件上传小部件的经验。文档和社区都知道如何使用 ASP.NET
之外的其他服务器技术接收服务器上的文件。如果有人确实在他们的 asp.net 页面中使用过该小部件,您可以分享
如何接收上传的文件流/字节到文件。
如何检查文件的完整性
如何检查文件是否正确接收。
另外,我很想在单页中执行此操作,因为这样做我将学习如何区分正常的网页请求和导致我的文件上传小部件的
雅虎上传小部件可以在这里找到:https://developer.yahoo .com/yui/uploader/
。
Many might have had experience using File Upload widget from Yahoo User Interface library
. The docs and community all know how to receive the files on the server using another server technology other than ASP.NET
. If anyone has indeed used the widget in their asp.net pages could you share the code on
How to receive the uploaded files Stream/Bytes to a file.
How to check Integrity of the File
How to check if file was received correctly.
Also i would love to do it in single page because doing so i would learn how to differentiate between a normal webpage request and the one caused my file upload widget
Yahoo Upload Widget can be Found here: https://developer.yahoo.com/yui/uploader/
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过查看 postsfiles 集合?该 API 看起来像是一个标准的帖子。如果是,则只需使用该集合即可。
如果没有,那么您需要使用请求对象上的 inputstream 属性来读取传入的字节。
使用 Fiddler 或 firebug 等工具会告诉您它是如何发出请求的。查找请求类型为 multipart/mime
编辑
检查文件完整性&是否正确上传几乎是不可能的。我能想到的唯一方法是让用户生成文件的哈希值,然后上传文件并上传文件。哈希值&您检查哈希值是否有效。即不太实用。
您得到的只是字节流。你必须假设当流结束时,它干净地结束了并且结束了。你得到了所有的文件。
Have you tried looking at postedfiles collection though? The API looks like it does a standard post. If it does, the just use that collection.
If it doesn't, then you need to use the inputstream property on the request object to read the incoming bytes.
Using something like Fiddler or firebug will tell you how it's making the request. Look for the request type being multipart/mime
edit
Checking the file integrity & whether it was uploaded correctly are pretty much impossible. The only way I can think to do it is to have the user generate a hash of the file then upload the file & the hash & you check the hash is valid. ie not really practical.
All you're getting is a stream of bytes. you have to assume when the stream ends, it ended cleanly & you got all the file.
我在这里用代码回答了我自己的问题。
http://labs. deeptechtons.com/asp-net-tuts/how-to-upload-files-asynchronously-using-yahoo-uploader/
I answered my own question with code over here.
http://labs.deeptechtons.com/asp-net-tuts/how-to-upload-files-asynchronously-using-yahoo-uploader/