search

不使用控件,好像只能用flash实现了?


回复讨论(解决方案)

当然的了。php不支持吧

不使用控件,好像只能用flash实现了? 不用控件基本上不好实现。你可以看下QQ邮箱里面的大附件上传功能,百度网盘,DBank(华为网盘),115网盘,360网盘他们的断点续传功全部都是自已开发的控件来实现的。而不是使用Flash来实现的。

不使用控件,好像只能用flash实现了? 在实际网络环境中一般30MB左右的文件都需要借助于控件来实现。一方面是因为国内的网络环境不太稳定,另一方面是从服务器的负载方面考虑。
一般情况下我们的网站用户有的可能用的电信的网络,有的用的是联通的网络,有的是用的教育网,有的在南有的在北,这种复杂的网络环境导致他们访问网站的速度是不同的。有的用户网速快,比如电信的用户访问电信的机房肯定快,他上传大文件可能没有问题。但是联通的访问电信的机房可能就慢了,他上传大文件可能就出现上传超时,掉线等问题。

服务器负载的问题,现在普通的文件上传技术对服务端带来的压力还是非常大的。普通的HTML上传1G的文件,服务端需要先分配1G的内存,然后开个长连接一直等待客户上传完毕。在这个期间如果有其它的用户也要上传1G的文件,那么服务端就再分配1G的内存。可以想象如果用户多了,那服务器肯定扛不住挂扯。就算是用Flash也一样,比如swfupload还有其它的几个Flash控件,他们使用的技术还是和普通的HTML一样。

腾迅他们正是考虑了这个问题,所以使用控件来解决这个问题。他们通过控件将一个大文件,比如1G划分成许多的小块,每一小块大约是128KB,然后循环上传,直到上传完。这样做的优点就是减轻了服务端的压力,提高了服务端的负载能力,使得服务端能够处理的用户请求数多了。也节省了成本。

不使用控件,好像只能用flash实现了? 传统的HTML方式已经难已满足超大文件的上传。别说是100MB,50MB对服务器来说都是非常大的,服务不仅要专门开一个socket连接接一直等待这个文件上传完毕,还要分配同等大小的内存来保存这个文件对服务器造成的压力相当的大,而且这个压力将会随着用户的增加而成几何式的增加。就算是用Flash也不行,因为目前的Flash不支持断点续传操作,也不支持文件分块操作,Flash和传统的HTML方式上传原理一样。用Flash上传100MB图片,服务器也要分配100MB的内存。10个用户同时上传100MB数据的话,就要吃掉服务器1G的内存。
Flash上传时是将整个文件加截到内存中的,这是比较严重的问题。因为如果用户要上传5G的文件,Flash也会将5G文件全部加载到内存中。这样会严重影响用户的操作体验。因为这时用户的电脑会处于假死状态。一般用户电脑也就2G,所以直接挂掉,内存不足,或内存溢出。

有些朋友试过用Flash文件上传控件来上传超大文件,但是经常遇到上传超时,或上传出错的问题。这是因为现在的Flash文件上传控件使用的技术还是和传统的HTML方式上传一样。让服务器打开一个连接,然后一直等到客户端把这个文件传完。但是在实际的网络环境中,用户的网速可能只有50KB/S,上传200MB的文件可能要花2.8小时。但是服务器的SESSION连接不可能为用户等2.8个小时,这还不考虑复杂的网络环境,比如数据包丢失的情况。如果遇到数据包丢失和网络异常的情况,那用户前面的100MB文件是白传了。这相当于浪费了用户一个小时的时间。给用户带来了极差的体验。
对于服务器来讲,连接资源是非常有限的,就算服务器能够为一个用户等2.8个小时,如果用户访问一大,每一个用户都占用一个连接并且占用这么长时间,那么服务器的并发处理能力就变的非常低了。其它的用户就算是请求一个简单的1KB的HTML页面也必须等服务器处理完前面的用户的请求。

同时Flash也无法满足超大文件的上传需求。因为超大文件上传需求有一个要求就是要保证数据传输的稳定性。比如用户上传1G的文件,已经上传了500MB,这时网突然断了,但是用户希望下次传这个文件的时侯是从最后一次上传的位置开始传输,也就是从500MB的位置开始传输,这一个需求是Flash是无法做到的。

像QQ邮箱中的超大附件上传功能,115网盘中的超大附件上传控件,华为网盘(DBank),金山快盘他们都是使用控件来实现超大文件上传功能的。这样做主要是减轻服务器压力(服务器响应时间更快,并发处理能力更强),节省服务器内存(服务器不必为每个用户都分配与文件同等大小的内存),同时提高用户体验(用户可在复杂的网络环境中上传超大文件)。

当然从技术角度来讲,像这些互联网知名企业也是考虑了支撑海量用户的分布式文件存储构架设计。因为他们的文件存储服务器不可能是一台,而且会动态的随着用户数的增加而增加。

如果真如某些朋友所说的Flash控件就能解决超大文件上传的问题,那么腾迅也不会花那么大的力气专门为QQ邮箱开发一个控件了。

不使用控件,好像只能用flash实现了? 用PHP或者用Flash实现断点续传的最大问题在于如何将1GB数据一次性传到Web服务器上面。Flash由于安全问题在对超大文件的处理性能上面存在很大的问题。

flash 也属于控件范畴
断点续传上传比断点续传下载还要容易实现

只要是断点续传,那就是双方的事情了,两端都要支持才行

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
The Continued Use of PHP: Reasons for Its EnduranceThe Continued Use of PHP: Reasons for Its EnduranceApr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python: Exploring Their Similarities and DifferencesPHP and Python: Exploring Their Similarities and DifferencesApr 19, 2025 am 12:21 AM

PHP and Python are both high-level programming languages ​​that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.