I want to create a file upload feature using an HTML file like this
using VBRichClient with code like thisCode:<html> <body> <form action="http://192.168.1.18:81/upload" method="POST" enctype="multipart/form-data"> <input type="file" name="file_upload" required> <button type="submit" name="submit">send</button> </form> </body> </html>
how do I get the filename? Also, after checking the resulting file, I found that ------WebKitFormBoundary appears at the beginning and end of the file — because of this, JPG files are being recognized as corrupted.Code:Private WithEvents ws As RC6.cWebServer Private Sub Form_Load() Set ws = New_c.WebServer ws.Listen App.Path, New_c.TCPServer.GetIP(vbNullString), 81 End Sub Private Sub ws_ProcessRequest(Request As RC6.cWebRequest) Dim i As Long If Request.Method = HTTP_POST Then For i = 0 To Request.FormData.Count - 1 Debug.Print Request.FormData.KeyByIndex(i) & ":" 'error & Request.FormData.ItemByIndex(i) Next New_c.FSO.WriteByteContent App.Path & "\test.jpg", Request.GetData End If End Sub


Reply With Quote