不使用上传控制 [英] without use upload control

查看:39
本文介绍了不使用上传控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为特定文件夹上载一些文档
不使用asp.net中的上传控件.正确的程序是什么?

Upload some document for a specific folder
without use upload control in asp.net. What is the correct procedure?
Help me!

推荐答案

如果您想做某事,并且不想使用唯一可以完成所需工作的工具,则需要告诉我我们为什么,因为您问错了问题.答案是,您可以使用Flash组件或ActiveX控件从网页上载内容,但是使用HTML和javascript(您决定不使用的内容)是唯一的选择.
If you want to do something, and you don''t want to use the only tool that can do what you want, you need to tell us why, because you''re asking the wrong question. the answer is, you can upload things from a web page using a flash component, or an activeX control, but using HTML and javascript, the thing you''ve decided not to use, is the only option you have.


最基本的上传方法是使用纯HTML form和"post"方法.其内部HTML应包含提交"类型的按钮.要发布文件,您将需要类型为文件"的input元素.最少可以是这样的:
The most basic method of upload is using a plain HTML form with the method "post". Its inner HTML should contain a button of the "submit" type. To post a file, you will need an input element of the type "file". Minimally, it can be something like this:
<form name="someFormName" enctype="multipart/form-data" action="/some-URL/" method="post">
    <!-- ... -->
    <input type="file" name="File"></input>
    <!-- ... -->
    <button type="submit">Some button content, like "Post it!" :-)</button>
</form>


所有包含用户编辑并发布到服务器端的数据的输入元素,都应使用具有唯一值的属性name进行标记;这些值在服务器端用于标识,索引和检索发布数据.

更精细的文件发布方法可以基于使用AJAX的JavaScript.
请参阅:
http://en.wikipedia.org/wiki/Ajax_%28programming%29 [ ^ ],
https://developer.mozilla.org/en/AJAX/Getting_Started [
一种有趣且高级的方法是使用jQuery"uplodify"插件:
http://www.uploadify.com/ [ ^ ].

另请参见:
http://ajaxuploader.com/?gclid=CJyZ18qmubECFQff4Aodq3QAlQ [ http://msdn.microsoft.com/en-us/magazine/cc188942.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.web. httprequest.aspx [ ^ ].

这是一个最小的代码示例:
http://stackoverflow.com/questions/569565/uploading-files-in-asp-net-without-using-the-fileupload-server-control [


All input elements containing data edited by the user and posted to the server side, should be marked with the attributes name with unique values; those values are used on the server side to identify, index and retrieve the post data.

More fine-grain method of posting a file could be based on JavaScript using AJAX.
Please see:
http://en.wikipedia.org/wiki/Ajax_%28programming%29[^],
https://developer.mozilla.org/en/AJAX/Getting_Started[^].

First method is based on pure HTML, the second one one HTML + JavaScript. Both methods are "raw", do not use any special control, nothing specific to ASP.NET or any other framework. By the way, for proper understanding of technology, it''s very important to understand how to work with such basic techniques, not using any frameworks or libraries.

One interesting and advanced approach is using jQuery "uplodify" plug-in:
http://www.uploadify.com/[^].

See also:
http://ajaxuploader.com/?gclid=CJyZ18qmubECFQff4Aodq3QAlQ[^].

Processing the HTTP request with ASP.NET (with uploads or not) is a separate story. You can star here:
http://msdn.microsoft.com/en-us/magazine/cc188942.aspx[^],
http://msdn.microsoft.com/en-us/library/system.web.httprequest.aspx[^].

This is a minimal code sample:
http://stackoverflow.com/questions/569565/uploading-files-in-asp-net-without-using-the-fileupload-server-control[^].

By the way, this code sample was in the post in reply to the question almost identical to yours, please see? Why could not you find it by yourself? You are more interested in that than I am. Well, if you have been banned by Google or Bing, this would be a good excuse… :-)

—SA


这篇关于不使用上传控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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