How is PHP large file upload implemented?

Source: Internet
Author: User
This post was last edited by xq_blessing on 2012-06-25 09:01:11




Title, video sites want to realize the user to share their own video (size control within 1G).

Directly on the code is more grateful ~






Reply to discussion (solution)



Php+flash Upload



Just like the Youku video upload, how is it done?



Upload_max_filesize and Post_max_size

http://www.howareyou.org.cn/?p=162



Change the relevant parameters of the php.ini, PHP 2G or within the file can be



I don't know what kind of station the landlord is going to make.



Use the Flash bar ordinary can not do



If, only part of the internal personnel, use, directly open FTP.



Support LS too big words directly with the FTP better



Title, video sites want to realize the user to share their own video (size control within 1G).

Directly on the code is more grateful ~
The traditional HTML method has been difficult to meet the large file upload. Don't say it is 100MB,50MB to the server is very large, service not only to open a link waiting for this file upload complete, but also to allocate the same large miss memory to save this file on the server pressure is quite large. Even if it is not with Flash, because the current flash does not support the continuation of the breakpoint operation, also does not support file block operation, Flash and the traditional way of HTML upload principle. Upload 100MB images with flash, and the server will allocate 100MB of memory. 10 users upload 100MB data at the same time, will eat server 1G of memory.
Some friends have tried to upload large files with the Flash file upload control, but often encounter upload time-outs, or upload errors. This is because the Flash file upload control now uses the same technology as the traditional HTML upload. Without the use of multipart upload technology, this traditional way of uploading HTML requires the server to open a socket connection until the Flash upload is complete. This can be very stressful to the server in case of large concurrency, because the site has a large number of accesses, the user uploads more files, the server can not be a user for a long time. It is hoped that the user's request can be processed in the shortest possible time.
Like QQ mailbox in the super-large attachment upload function, 115 network disk in the large attachment upload control,Network Disk (Dbank), Jinshan fast disk they are all using the control to achieve large file upload function. This is done primarily to relieve server pressure, save server memory, and improve the user experience.



If, only part of the internal personnel, use, directly open FTP.

FTP is also available for most people. FTP can install extended write scripts to support the database. Of course, there is a security risk.


Title, video sites want to realize the user to share their own video (size control within 1G).

Directly on the code is more grateful ~
There is a web large file on the Internet Breakpoint Continuation control: http://www.cnblogs.com/xproer/archive/2012/05/29/2523757.html
This control supports 100G file's breakpoint continuation operation, provides complete development documentation, supports file MD5 verification, and supports file bulk upload.
Paste files, simplify the selection of file operations:

File MD5 value Calculation progress:

File MD5 Value Calculated

The server detects if the same file exists based on MD5

Continuation of documents

Load a list of files from the server

The file crosses

File Upload Complete

Upload Folder

and discuz! X2 Integration-Background installation breakpoint continuation control

and discuz! X2 Integration-Enable breakpoint continuation control in the background

and discuz! X2 Integration-Background breakpoint continuation control enabled successfully

and discuz! X2 Integration-Front desk Posting page

and discuz! X2 Integration-Upload


The page invokes the sample code:




<title>HTTP breakpoint continuation control and MySQL database Demo page (UTF-8)</title>











Resources Download:
CAB installation package
Development documentation
asp.net-access-gb2312 Example
jsp-access-gb2312 Example
Jsp-access-utf8 Example
Jsp-sqlserver2005-utf8 Example
Jsp-mysql-utf8 Example
Php-mysql-utf8 Example

Reference to the landlord's reply:
Title, video sites want to realize the user to share their own video (size control within 1G).

Directly on the code is more grateful ~

Xproer.httpuploader4
This control supports 100G file's breakpoint continuation operation, provides complete development documentation, supports file MD5 verification, and supports file bulk upload.
Paste files, simplify the selection of file operations:

File MD5 value Calculation progress:

File MD5 Value Calculated

The server detects if the same file exists based on MD5

Continuation of documents

Load a list of files from the server

The file crosses

File Upload Complete

Upload Folder

and discuz! X2 Integration-Background installation breakpoint continuation control

and discuz! X2 Integration-Enable breakpoint continuation control in the background

and discuz! X2 Integration-Background breakpoint continuation control enabled successfully

and discuz! X2 Integration-Front desk Posting page

and discuz! X2 Integration-Upload


The page invokes the sample code:





<title>HTTP breakpoint continuation control and MySQL database Demo page (UTF-8)</title>












Resources Download:
CAB installation package
Development documentation
asp.net-access-gb2312 Example
jsp-access-gb2312 Example
Jsp-access-utf8 Example
Jsp-sqlserver2005-utf8 Example
Jsp-mysql-utf8 Example
Php-mysql-utf8 Example
This is very good.

In a real-world network environment, files around 100MB need to be implemented using controls. On the one hand because the domestic network environment is not very stable, on the other hand, from the server load considerations.
Some of our website users may use the network of telecommunications, some with the network of Unicom, some with the education network, some in the south of some in the north, this complex network environment causes them to visit the site of different speed. Some users fast speed, such as telecommunications users to access the telecommunications room must be fast, he uploaded large files may be no problem. But Unicom's visit to the telecommunications engine room may be slow, he uploaded large files may appear upload timeout, drop lines and other issues.

Server load problem, now the normal file upload technology on the service side of the pressure is still very large. Ordinary HTML upload 1G files, the server needs to allocate 1G of memory first, and then open a long connection has been waiting for the customer upload completed. In this period, if there are other users to upload 1G files, then the server will allocate 1G of memory. It can be imagined that if the user is more, the server must not carry the hanging. Even with flash, such as SWFUpload and several other flash controls, they use the same technology as normal HTML.

Tencent they were thinking about the problem, so use the controls to solve the problem. They use a control to divide a large file, such as 1G, into small chunks, each of which is about 128KB, and then loop through the upload until it is finished uploading. The advantage of this is to reduce the pressure on the service side, improve the load capacity of the service side, so that the server can handle more user requests. Also cost savings.


You must use the control ...



Reference to the 12 floor of the reply:

Reference to the landlord's reply:
Title, video sites want to realize the user to share their own video (size control within 1G).

Directly on the code is more grateful ~

Xproer.httpuploader4
This control supports 100G file's breakpoint continuation operation, provides complete development documentation, supports file MD5 verification, and supports file bulk upload.
Paste files, simplify the selection of file operations:

File MD5 value Calculation progress:

File MD5 Value Calculated
......

Actually has been out of the web, just a C/s.



SOCKET or Curl



This kind of resource is hard to get people to go directly to the code.



Mark 12 Floor



Reference to the 13 floor of the reply:

Reference to the 12 floor of the reply:

Reference to the landlord's reply:
Title, video sites want to realize the user to share their own video (size control within 1G).

Directly on the code is more grateful ~

Xproer.httpuploader4
This control supports 100G file's breakpoint continuation operation, provides complete development documentation, supports file MD5 verification, and supports file bulk upload.
Paste files, simplify the selection of file operations:

File MD5 value calculation progress ...
Looks like now all is the client and the service side unifies, for the user to be useful, the use most important, namely user experience most important. Users do not care whether you are the C/s or b/s, he will realize this function, you use B/s to make a line, with C.

We from the practice of well-known enterprises can understand this truth, QQ mailbox in the large attachment upload control is also used to do, QQ mailbox screenshots are also used to do the control, the QQ space album inside the picture upload control is also used to do the control. These are the C/s. Few users care whether C/S, they only care about good.

Another seemingly QQ mailbox in the large attachment upload control help QQ won a lot of market. When Tencent just launched this feature, everyone was excited about the birds. Feel QQ mailbox for the industry to do a very good thing, that excited ah.



Reference to the landlord's reply:
Title, video sites want to realize the user to share their own video (size control within 1G).

Directly on the code is more grateful ~

There is a web large file on the Internet Breakpoint Continuation control: http://www.cnblogs.com/xproer/archive/2012/05/29/2523757.html
This control supports 100G file's breakpoint continuation operation, provides complete development documentation, supports file MD5 verification, and supports file bulk upload.
Paste the text ...

Thanks for your hard work.



Reference to the landlord's reply:
Title, video sites want to realize the user to share their own video (size control within 1G).

Directly on the code is more grateful ~

The traditional HTML method has been difficult to meet the large file upload. Don't say it is 100MB,50MB to the server is very large, service not only to open a link waiting for this file upload complete, but also to allocate the same large miss memory to save this file on the server pressure is quite large. Even if it is not with Flash, because the current flash does not support the continuation of the breakpoint ...

The Master study



Thanks for sharing, if that control HttpUploader5 useful, it's great.



There are selfless people did not ah, we learn to communicate together



There are so many things worth learning.


  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.