Javascript-php did a from form video upload function, the PC test was successful, both iOS and Android failed

Source: Internet
Author: User
HTML page code

PHP code

print_r($_FILES);//Android时,这里输出为空,但是上传文件的临时文件夹是看到有文件生成的。//ios时,这里输出的是正常的(与pc时一致,error代码也是0),但是在服务端视频文件的大小为0k,并且服务端打开视频说这是一个空白/缺损视频$file=$_FILES['testFile'];move_uploaded_file($file["tmp_name"],"upload/" .$file["name"]);echo "保存成功: " . "upload/" . $file["name"];

Is there a way to solve this problem? This is only used on mobile phones, so you can use a variety of technologies such as HTML5 and other mobile web support

Reply content:

HTML page code

PHP code

print_r($_FILES);//Android时,这里输出为空,但是上传文件的临时文件夹是看到有文件生成的。//ios时,这里输出的是正常的(与pc时一致,error代码也是0),但是在服务端视频文件的大小为0k,并且服务端打开视频说这是一个空白/缺损视频$file=$_FILES['testFile'];move_uploaded_file($file["tmp_name"],"upload/" .$file["name"]);echo "保存成功: " . "upload/" . $file["name"];

Is there a way to solve this problem? This is only used on mobile phones, so you can use a variety of technologies such as HTML5 and other mobile web support

Up to now, iOS video upload is done, but only one video at a time (perhaps you can do more than one fileinput to allow users to choose several times to upload multiple videos, but which demand is so perverted!) )

First of all

Need to be multiple="multiple" removed, because iOS select a single file, if this is a video file, will automatically compress the video (compression process is in the video selection interface, do not need us to do anything), but if it is a multi-select file, it will not be automatically compressed, resulting upload to the service side of the video is always 0k, and no error.

And then

If the server is PHP, then you need to follow the http://www.admin10000.com/Document/69.html configuration php.ini file, as to php.ini where to find the file, if you are Wamp, Then in the Wamp folder there search php.ini, the result will be two, it should be Apache below, if changed not yet, on the other one also changed.

Problems that still exist

Android is still the same problem, no error, there is upload action (in the upload folder can see the temporary file generation) But after this action is finished not to see the upload file, and Print_r ($_files), the result is an Array() empty array ...

But see iOS compressed video after uploading success, perhaps the breakthrough is compressed video, I now look for JS compressed video method

February 4, 2015 10:49:28 update

Found millet 1s (the year before the student dog, poor, bought, and now put in the company when the test machine) incredibly can successfully upload!!! I'll try another android.

Kiss, I'm wrong, the problem is solved.

The original problem is php.ini the setting! I have a test machine with the video is 83M, but php.ini set the maximum upload file is 80M, so it will fail! Now iOS and Android on my hands are all successful, and it's not recommended that you choose the multiple-file input file!

Using the browser to perform the upload file may have a puzzling problem, this problem I have encountered before the development of third-party applications. In the final analysis, there are special treatments and limitations.

It is recommended that you use the mobile system browser to test, if normal, your code is OK, it is recommended that the system browser performance prevail.

PS: Has launched the JS-SDK, including file upload, it is recommended that you have the necessary circumstances to see the open JS-SDK, to assist the 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.