1. 程式人生 > >ueditor編輯器asp版不能上傳圖片的解決方法(800a0046)

ueditor編輯器asp版不能上傳圖片的解決方法(800a0046)

第一步,先去IIS 中,開啟ASP 設定頁面,把錯誤資訊傳送到瀏覽器,有助於找到問題。


使用百度開源ueditor編輯器不能上傳圖片並報伺服器500錯誤

初看是 Uploader.Class 的 fs.CreateFolder( path ) 這條語句不能建立目錄,懷疑許可權問題,提供所有許可權後,依然不行。

最後參考百度官方文件將該程式碼內函式

    Private Function CheckOrCreatePath( ByVal path )
        Set fs = Server.CreateObject("Scripting.FileSystemObject")
        Dim parts
        parts = Split( path, "\" )
        For Each part in parts
            path = path + part + "\"
            If fs.FolderExists( path ) = False Then
                fs.CreateFolder( path )
            End If
        Next
    End Function

修改為 

    Private Function CheckOrCreatePath( ByVal path )
        Set fs = Server.CreateObject("Scripting.FileSystemObject")
        Dim parts
        Dim root : root = Server.mappath("/") & "\"
        parts = Split( Replace(path, root, ""), "\" )
        path = root
        For Each part in parts
            path = path + part + "\"
            If fs.FolderExists( path ) = False Then
                fs.CreateFolder( path )
            End If
        Next
    End Function


即可正常上傳。