問題描述
我有一個以前可以使用的圖片上傳腳本.它現在壞了,我已經將問題追溯到一行:
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.
該腳本僅在運行 MAMP 1.9.5 的本地測試環境 OSX 10.6.7 上損壞.幸運的是,實時站點運行良好.
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的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!