0
我試圖從tmp文件夾中獲取一個叫做用戶submits.png的圖像,並將其放入Business_Names文件夾/無論用戶輸入什麼內容。我有麻煩在PHP中解釋它給我的錯誤是該文件不存在在php中的Concat不是正確的文件路徑
$filename = str_replace(" ","_", trim($username));
mkdir("Business_Pages/". $filename."/");
if($fp = fopen("Business_Pages/". $filename . "/" . $filename . ".php", "w"))
{
fwrite($fp,"<?php session_start();");
fwrite($fp,"if(isset(\$_SESSION['id'])) { ?>");
fwrite($fp, $doctype.$htmlOpen.$head.$bodyOpen.$header.$wcImage.$accountTable.$linksTable.$bodyClose.$htmlClose);
fwrite($fp,"<?php } else { echo \"User not logged in\";} ?>");
fclose($fp);
}
$tmpdir = "tmp/";
$userdir = "Business_Pages/ . $filename . '/' ";
rename("$tmpdir . $filename . '/' . '.png'",
"$userdir . $filename . '/' '.png'");
你能複製在這裏,你得到錯誤信息? – 2013-05-07 05:42:35
從'tmp'文件夾複製?如果你允許用戶上傳文件,你應該使用['move_uploaded_file()'](http://php.net/manual/en/function.move-uploaded-file.php)來移動它。 – Arjan 2013-05-07 06:07:49
我用move_uploaded_file()將它移動到tmp – user2354835 2013-05-07 06:14:41