我想upload個file上網,然後改名, 但是發生錯誤,如下:
Microsoft VBScript 執行階段錯誤- Error '800a0046' 沒有使用權限 /upload.asp, line 55
Why? 我check過user有執行權, File upload左上去,但是改吾到名....
-----------------------------------------------------------------------------------------------
strTargetPath = server.mappath("/img") ' 伺服器的目的資料夾
strFile = request.querystring("id")set fs=server.createobject("Scripting.FileSystemObject")
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then ' 建立物件
Set objUpload = GetUpload()
strMessage =""
If Err = 0 Then
For Each objField In objUpload.Items
strFileName = ""
If objField.FileName <> "" Then
strFileName = objField.FileName
' 儲存檔案的內容
objField.Value.SaveAs strTargetPath & "/" & strFileName
source = server.mappath("/img/"& strFilename)
target = server.mappath("/img/"& strFile)
fs.moveFile source, target
End If
Next
response.redirect "member_index.asp"
strFile = ""
else
strMessage = strMessage &"<br>發生錯誤:"& Err.Description
End if