Jos*_*her 14 c# asp.net uploadify
这看起来应该很容易,但我无法让它工作.我不知道为什么不这样做.它只显示正常的文件输入.
是否有任何代码/示例来实现这一点.我很沮丧......
谢谢你们.
Jas*_*son 19
这是一个关于如何开始使用C#和Webforms的视频教程,应该可以帮到你.
http://casonclagg.com/articles/6/video-tutorial-uploadify-asp-net-c-sharp.aspx
你可以发布你的代码,以便我可以告诉你你做错了什么吗?
这是我为asp.net提供的示例代码
<script type="text/javascript">
// <![CDATA[
var id = "55";
var theString = "asdf";
$(document).ready(function() {
$('#fileInput').uploadify({
'uploader': 'uploadify/uploadify.swf',
'script': 'Upload.ashx',
'scriptData': { 'id': id, 'foo': theString},
'cancelImg': 'uploadify/cancel.png',
'auto': true,
'multi': true,
'fileDesc': 'Image Files',
'fileExt': '*.jpg;*.png;*.gif;*.bmp;*.jpeg',
'queueSizeLimit': 90,
'sizeLimit': 4000000,
'buttonText': 'Choose Images',
'folder': '/uploads',
'onAllComplete': function(event, queueID, fileObj, response, data) {
}
});
});
// ]]></script>
<input id="fileInput" name="fileInput" type="file" />
Run Code Online (Sandbox Code Playgroud)
然后你想制作一个处理程序(.ashx):
public class Upload : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
try
{
HttpPostedFile file= context.Request.Files["Filedata"];
int id = (Int32.Parse(context.Request["id"]));
string foo = context.Request["foo"];
file.SaveAs("C:\\" + id.ToString() + foo + file.FileName);
context.Response.Write("1");
}
catch(Exception ex)
{
context.Response.Write("0");
}
}
}
Run Code Online (Sandbox Code Playgroud)
发布你的代码,我会看看它.听起来你正指向一个不存在的资源.也许你的'uploader'属性没有指向正确的资源或你的jquery链接被破坏(或没有).