Javascript-php implements the from form video upload function. The test is successful on the pc and fails on both ios and Android.

Source: Internet
Author: User
Html page code {code...} php code {code...} is there a way to solve this problem? This is only used on mobile phones, so you can use html page code of various technologies supported by mobile web such as html5

Php code

Print_r ($ _ FILES); // for Android, the output here is empty, but the temporary folder of the uploaded file shows that a file is generated. // In ios, the output is normal (same as in pc, the error code is also 0), but the video file size on the server is 0 k, the server opens the video and says this is a blank/Defective video $ file =$ _ FILES ['testfile']; move_uploaded_file ($ file ["tmp_name"], "upload /". $ file ["name"]); echo "saved successfully :". "upload /". $ file ["name"];

Is there a way to solve this problem? This is only used on mobile phones, so html5 and other mobile web-supported technologies can be used.

Reply content:

Html page code

Php code

Print_r ($ _ FILES); // for Android, the output here is empty, but the temporary folder of the uploaded file shows that a file is generated. // In ios, the output is normal (same as in pc, the error code is also 0), but the video file size on the server is 0 k, the server opens the video and says this is a blank/Defective video $ file =$ _ FILES ['testfile']; move_uploaded_file ($ file ["tmp_name"], "upload /". $ file ["name"]); echo "saved successfully :". "upload /". $ file ["name"];

Is there a way to solve this problem? This is only used on mobile phones, so html5 and other mobile web-supported technologies can be used.

Up to now, ios video upload has been completed, but only one video can be selected at a time (maybe multiple fileinputs can be selected multiple times for users to upload multiple videos, but which one is so abnormal !)

First

You needmultiple="multiple"Remove this because when ios selects a single file, if this is a video file, the video will be automatically compressed (the compression process is on the video selection page and we don't need to do anything ), however, if you select multiple files, the files will not be automatically compressed. As a result, the video uploaded to the server is always 0 kb and no error is reported.

Then

If the server is php, follow http://www.adminapps.com/document/69.htmlphp.iniFile, asphp.iniWhere to find the file. If you are using wamp, search for php in the wamp folder. ini, there will be two results, which should be under apache. If the change fails, the other one will be changed.

Existing Problems

Android still has the same problem. No error is reported. There is an upload action (temporary file generation can be seen in the upload folder). However, after this action is completed, no Upload File is displayed, and the result of print_r ($ _ FILES); isArray()Empty array...

However, after the ios video is compressed, the upload is successful. Maybe the breakthrough point is to compress the video. Now I want to find a method for viewing the js compressed video.

February 4, 2015 10:49:28 update

I found that Xiaomi 1 s (students and dogs in the previous year, poor, bought, and now used as a testing machine in the company) could be uploaded successfully !!! I will try another Android

Dear friends, I am wrong and the problem has been solved.

The main problem wasphp.ini! I have a video with a test machine of 83M,php.iniSet the maximum file size to 80 Mb! Now, both ios and Android have succeeded, and it is not recommended that you select multiple file input files!

Using a browser to upload files may cause an inexplicable write problem. I have encountered this problem before developing a third-party application. In the final analysis, it is caused by special processing and restrictions.

We recommend that you use the browser of the mobile phone system for testing. If it is normal, your code is OK. We recommend that you use the browser of the system for testing.

Ps: has launched the js-sdk, including file upload, it is recommended that you have the necessary circumstances can look at the open JS-SDK, assist web development and JS-SDK Sample Page.

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.