简体   繁体   English

使用ASP,ASP.NET 2.0或PHP5在IIS6上没有超时的开源文件上载

[英]Open source file upload with no timeout on IIS6 with ASP, ASP.NET 2.0 or PHP5

I'm after a cross-platform cross-browser way of uploading files such that there is no timeout. 我正在采用跨平台的跨浏览器方式上传文件,这样就没有超时。 Uploads aren't necessarily huge -- some just take a long time to upload because of the uploader's slow connection -- but the server times out anyway. 上传不一定很大 - 由于上传器连接速度慢,有些上传只需要很长时间 - 但服务器无论如何都要超时。

I hear that there are methods to upload files in chunks so that somehow the server decides not to timeout the upload. 我听说有方法以块的形式上传文件,以便服务器以某种方式决定不上传内容。 After searching around all I can see is proprietary upload helpers and Java and Flash (SWFUpload) widgets that aren't cross-platform, don't upload in chunks, or aren't free. 在搜索了所有我可以看到的是专有的上传帮助程序和Java和Flash(SWFUpload)小部件,这些小部件不是跨平台的,不会以块的形式上传,或者不是免费的。

I'd like a way to do it in any of these platforms (ASP, ASP.NET 2.0 or PHP5), though I am not very clued up on all this .NET class/controller/project/module/visual studio/compile/etc stuff, so some kind of runnable complete project that runs on .NET 2.0 would be helpful. 我想在任何这些平台(ASP,ASP.NET 2.0或PHP5)中做到这一点,虽然我不是很熟悉这个.NET类/控制器/项目/模块/ visual studio / compile /等东西,所以在.NET 2.0上运行的某种可运行的完整项目会很有帮助。 PHP and ASP I can assume will be more straight-forward. 我可以假设PHP和ASP会更直接。

Unless I am completely missing something, which I suspect/hope I am, reasonable web uploads are bloody hard work in any language or platform. 除非我完全遗漏某些东西,我怀疑/希望是这样,合理的网络上传在任何语言或平台上都是血腥的努力工作。

So my question is: how can I perform web browser uploads, cross-platform, so that they don't timeout, using free software? 所以我的问题是:如何使用免费软件执行Web浏览器上传,跨平台,以便它们不会超时? Is it possible at all? 有可能吗?

I imagine the solution that you are really looking for is to gain more control over the server. 我想你正在寻找的解决方案是获得对服务器的更多控制。 IIS for example has a timeout setting in addition to any setting you provide in web.config or your php.ini. 例如,除了您在web.config或php.ini中提供的任何设置之外,IIS还具有超时设置。 If php is running in fast cgi then you also have fast cgi configuration. 如果php在快速cgi中运行,那么你也有快速的cgi配置。

You can then set relevant file size, memory and timeout settings in php.ini / web.config: 然后,您可以在php.ini / web.config中设置相关的文件大小,内存和超时设置:

php.ini - http://www.radinks.com/upload/config.php php.ini - http://www.radinks.com/upload/config.php

web.config - web.config -

<httpRuntime executionTimeout="1000" maxRequestLength="400000">

Asp.net provides the possibility to create html modules which provide some of the slicker (asp.net) upload controls, such as multiple uploads, straight to disk (less server memory usage) and upload progress controls, most of these are commercial though. Asp.net提供了创建html模块的可能性,这些模块提供了一些更流畅的(asp.net)上传控件,例如多个上传,直接到磁盘(更少的服务器内存使用)和上传进度控制,其中大部分是商业的。

No matter what language will deal with the file after the upload is complete, the actual upload is handled by the HTTP server (Apache, IIS, etc.). 上传完成后,无论使用何种语言处理文件,实际上传都由HTTP服务器(Apache,IIS等)处理。 The way I've seen 'progress bars' or other graphical uploads done in Flash is that there is an AJAX call made to a second script that uploads the file (which locks that thread until the upload is done), and the first script checks the file size of the incoming temporary file for a percentage done. 我在Flash中看到“进度条”或其他图形上传的方式是,对第二个脚本进行了AJAX调用,该脚本上传文件(锁定该线程直到上传完成),并且第一个脚本检查完成百分比的传入临时文件的文件大小。

If you're getting server timeouts while uploading, the issue is likely with your HTTP server (Apache/IIS) configuration, and not holding the connection open log enough. 如果您在上传时获得服务器超时,则可能是您的HTTP服务器(Apache / IIS)配置存在问题,而且没有足够的连接打开日志。 If you tried to set up a PHP file upload system and were getting PHP error messages, likely the ' upload_max_filesize ', ' memory_limit ', or ' post_max_size ' is set incorrectly in your PHP.ini (see PHP's post on file upload pitfals ). 如果您尝试设置PHP文件上载系统并且收到PHP错误消息,则可能在PHP.ini错误地设置了' upload_max_filesize ',' memory_limit '或' post_max_size '(请参阅PHP的文件上传pitfals文章 )。

Perhaps you can look at the source of Wordpress? 也许你可以看一下Wordpress的来源? They have both a "standard" file uploader and a flash file uploader. 他们有一个“标准”文件上传器和一个flash文件上传器。

That said, writing something that chunks something up in smaller bits and later puts it back together is bloody hard work. 也就是说,写一些东西以较小的比特分块然后将它重新组合起来是一项非常艰苦的工作。

A ducttape solution would be to rar it up in smaller bits, upload those bits and unpack it on the server. 一个ducttape解决方案是以较小的比特填充它,上传这些位并将其解压缩到服务器上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM