Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial PHP上传文件$_FILES无法接受到信息

PHP上传文件$_FILES无法接受到信息

Jun 23, 2016 pm 01:23 PM

各位好!

我写了一个小程序,用于上传视频文件。
在windows下测试的时候:
php5.5+apache2.4.9,php最大上传大小的两个配置已经设置为1024M
这时候上传任意视频都是没问题。

但是拿到linux上的时候:
php5.3+nginx,同样,php配置文件配置好,nginx.conf也将clinent_max_body_size设置为1024M。

但是从XP的系统上复制了一个名为“我是小海军0.mp4”的视频文件,140M左右,上传,$_FILES打印出来为空。
在我本机(win8)拷贝了两个视频文件,一个2M一个400M左右,都命名"我是小海军0.mp4",均上传成功,所以排除了中文名的问题。(我也在上传类中对中文名做了相应处理)。

现在实在想不出来了,最大上传大小限制可以排除,命名问题可以排除。那只能是文件的问题了,到底是啥问题呢。。

help...


回复讨论(解决方案)

看下是不是上传目录权限问题,有没有读写权限,改成775或者777试试

如果你没有设置上传文件格式先上传一个小文本文件测试一下。
包括代码(Linux下严格区分大小写)和Linux下权限问题(这个可能性最大了)
如果上传成功了那就是你上传文件大小限制出问题了。

上传文件的大小超过了 post_max_size 的限定

检查一下错误日志

post_max_size和upload_max_filesize都已经设置了1024M。nginx.conf也设置了clinent_max_body_size 1024M,不知道我这么设置对不对,网上找的方法。应该是没什么问题的。
问题的重点是:
400M左右的MP4可以上传,100M左右的MP4就上传不了,而且他们文件名是相同的。
我知道唯一的区别就是,100M的MP4文件是从XP系统的电脑上拷的,400M的MP4文件是我的电脑上的,win8。

因为不知道100M的文件的制作来源,也不清楚有什么可能的原因,所以不知道可以给出什么信息。
希望各位能够帮帮忙,如果需要一些其他的信息,我再发出来。

140那个文件,文件名改为纯数字字母,试下,排除下是不是编码问题。

140那个文件,文件名改为纯数字字母,试下,排除下是不是编码问题。



纯英文或者纯数字都不行,编码问题?

是用浏览器表单上传的吗?
XP系统有没有成功的文件?
从XP发字符串可以成功接收吗?

是用浏览器表单上传的吗?
XP系统有没有成功的文件?
从XP发字符串可以成功接收吗?


是的,表单提交,xp上也有成功的文件,发字符串也可以接受,那个不成功的文件,拿到我的机子上上传也没用。从XP上拷了两个文件过来,上传都接收不到

虽然你2014年问的问题,我还是要回答一下:
php 5.3  
php 5.5 
这2个版本对文件的上传 方法不是一样的哦

Statement of this Website
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

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Explain the concept of late static binding in PHP. Explain the concept of late static binding in PHP. Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP Logging: Best Practices for PHP Log Analysis PHP Logging: Best Practices for PHP Log Analysis Mar 10, 2025 pm 02:32 PM

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

HTTP Method Verification in Laravel HTTP Method Verification in Laravel Mar 05, 2025 pm 04:14 PM

Laravel simplifies HTTP verb handling in incoming requests, streamlining diverse operation management within your applications. The method() and isMethod() methods efficiently identify and validate request types. This feature is crucial for building

Discover File Downloads in Laravel with Storage::download Discover File Downloads in Laravel with Storage::download Mar 06, 2025 am 02:22 AM

The Storage::download method of the Laravel framework provides a concise API for safely handling file downloads while managing abstractions of file storage. Here is an example of using Storage::download() in the example controller:

See all articles