PHP:上传大文件后跳过/忽略mysql查询? [英] PHP: mysql query skipped/ignored after large file uploads?

查看:32
本文介绍了PHP:上传大文件后跳过/忽略mysql查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

奇怪...原本我认为 php 没有正确处理大文件上传 (800mb-2gb)

Weird... Originally i thought that php was not correctly handling large file uploads (800mb-2gb)

现在我发现文件已正确移动,但是在上传大文件时,似乎会跳过将文件信息输入数据库的 mysql 查询.

now i've figured out that the file is moved correctly, but the mysql query that enters the file info into the DB seems to be skipped when large files are uploaded.

mysql 查询在上传小文件时执行.这个问题似乎只出现在较大的文件中

The mysql query is executed like it should be when small files are uploaded. This problem only seems to arise with larger files

此外,移动文件之前的 mysql 查询似乎工作正常.

Also, the mysql queries before the file is moved seem to work fine.

过程:

Wait for uploaded file, 
check file size, 
get md5 of file, 
move file from temp folder to uploads folder, 
if moving file is successful then mysql query.

文件是应该在的地方,但查询没有执行.

The file is where is should be, but the query isnt executed.

我应该在移动文件后和调用 mysql 查询之间延迟 10 秒吗?

Should i put a 10 second delay between after the file is moved and when the mysql query is called?

推荐答案

如果文件移动正常,那么问题很可能出现在最后一步 - MySQL 查询.使用 error_reporting(E_ALL) 最大化错误级别并设置 PHP 错误日志 - 这将记录任何 MySQL 警告和任何其他问题.记录您尝试执行的 SQL 查询.它可以从 MySQL 客户端工作吗?

If the file move is working than the problem is most likely on the last step - the MySQL query. Max out the error level with error_reporting(E_ALL) and setup a PHP error log - this will record any MySQL warnings and any other problems. Log the SQL query you're trying to execute. Does it work from a MySQL client?

这篇关于PHP:上传大文件后跳过/忽略mysql查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆