如果文件名是fin's xyz.mp3
,則由於此fin(')的單引號而不能上傳。我應該如何在PHP中使用move_uploaded_file($tmp,$dest)
?文件上傳中的問題
例子:
$name1=$_FILES['FileName']['name'];
$tmp1=$_FILES['FileName']['tmp_name'];
$target = "../music_files/";
$up=uniqid().$name1;
$target = $target.$up;
move_uploaded_file($tmp1,$target);
HTML:
<form action="" method="post" enctype="multipart/form-data" name="loginfrm" onsubmit="return CheckLogin();">
<input type="file" id="FileName" name="FileName" class="text-box" />
<input name="Submit" type="submit" class="button" value="Save" />
</form>
你能告訴我們更多的代碼嗎?你如何處理文件上傳?什麼是'$ tmp'和'$ dest'? – 2010-08-16 12:21:43
@anuradha - 你可以嘗試格式化你的代碼,所以它更容易閱讀?將每行代碼縮進四個空格。 – 2010-08-16 12:29:18
使用降價按鈕編輯您的代碼。閱讀你的代碼很困難。 – stillstanding 2010-08-16 12:30:48