PHP的tmpfile()返回false [英] PHP tmpfile() returns false
问题描述
我有一个以前的图片上传脚本。现在已经坏了,我已经把问题追溯到一行:
I've got an image upload script which was previously working. It's now broken, and I've traced the problem down to one line:
$temp = tmpfile();
// $temp === false
tmpfile()函数返回false。我似乎无法弄清楚为什么。我在这个问题上很难通过Google。
The tmpfile() function is returning false. I can't seem to figure out why. I'm having a hard time wading through Google on this one.
这个脚本只在我的本地测试环境OSX 10.6.7上运行MAMP 1.9.5 。幸运的是,活的网站工作正常。
The script it only broken on my local test environment, OSX 10.6.7, running MAMP 1.9.5. Fortunately the live site is working fine.
推荐答案
如果无法创建临时文件,tmpfile()会返回 false
。确保您的tmp文件夹是可写的,并尝试检查 sys_get_temp_dir()
函数返回的结果。
tmpfile() returns false
if it is unable to create the temporary file. Make sure your tmp folder is writable and try and check what sys_get_temp_dir()
function returns.
这篇关于PHP的tmpfile()返回false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!