Re: [問題] Http file upload 問題
※ 引述《ffrr (冰色太陽)》之銘言:
: 附上原始碼
: http://rafb.net/p/rBFYPm71.html
: 暫時是用免空做上傳測試
: 目前上傳純文字檔都OK
: 但是上傳其他格式的檔案後,下載後都無法成功開啟
: 肯定是SOMETHING WRONG
: 不知道是HEADER 或是 POSTDATA 格式出錯
: 還是根本就用錯方法 ○| ̄|_
: 請高手指點一下吧
用錯方法
傳送 Binary 檔案, 就是有什麼就讀什麼, 不需要使用 StrConv() 做 Unicode 轉換
而且不可以用 String 來存放, 請用 Byte 陣列或是 Variant 存放
所以, 底下我只改一半, 剩下另一半你自己改
Dim sFormData() as Byte, d As Variant
GetFile(sFormData, FileName)
Function GetFile(ByRef FileContents() As Byte, FileName As String)
Dim FileNumber As Integer
ReDim FileContents(FileLen(FileName) - 1)
Open FileName For Binary As FileNumber
Get FileNumber, , FileContents
Close FileNumber
End Function
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 58.86.136.1
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 4 之 8 篇):