ERLEDIGT
NEIN
NEIN
ANTWORTEN
0
0
ZUGRIFFE
495
495
EMPFEHLEN
-
Hi,
ich will nun ein Bild oder eine Textdatei über ein PHP-Skript, das ich mir geschrieben hab, auf einen Server laden.
PHP-Skript: http://umbdata.esport-masters.com
Es ist so aufgebaut:
Man sucht sich eine Datei aus, gibt dann bei Passwort das Upload-Passwort ein und bei Ordner den jeweiligen Unterordner.
Das PHP-Skript funktioniert auch, wenn ich es selber bediene.
Nun will ich aber via HttpWebRequest von meinem VB-Programm aus eine Datei hochladen. Deshalb habe ich den Netzwerkverkehr, der bei diesem Skript entsteht, mal mitgeloggt:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
http://umbdata.esport-masters.com/ POST / HTTP/1.1 Host: umbdata.esport-masters.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://umbdata.esport-masters.com/ Content-Type: multipart/form-data; boundary=---------------------------265001916915724 Content-Length: 2665 -----------------------------265001916915724 Content-Disposition: form-data; name="datei"; filename="mitschnitt.txt" Content-Type: text/plain http://umbdata.esport-masters.com/ GET / HTTP/1.1 Host: umbdata.esport-masters.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive HTTP/1.x 200 OK Date: Sun, 07 Feb 2010 12:28:19 GMT Server: Apache/2.2.14 (EL) X-Powered-By: PHP/5.2.11 Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=ISO-8859-1 ---------------------------------------------------------- http://umbdata.esport-masters.com/favicon.ico GET /favicon.ico HTTP/1.1 Host: umbdata.esport-masters.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive HTTP/1.x 404 Not Found Date: Sun, 07 Feb 2010 12:28:22 GMT Server: Apache/2.2.14 (EL) Content-Length: 297 Connection: close Content-Type: text/html; charset=iso-8859-1 ---------------------------------------------------------- http://umbdata.esport-masters.com/ POST / HTTP/1.1 Host: umbdata.esport-masters.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://umbdata.esport-masters.com/ HTTP/1.x 200 OK Date: Sun, 07 Feb 2010 12:28:46 GMT Server: Apache/2.2.14 (EL) X-Powered-By: PHP/5.2.11 Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=ISO-8859-1 ---------------------------------------------------------- -----------------------------265001916915724 Content-Disposition: form-data; name="passwort" EsportMastersUmbrella2010-02 -----------------------------265001916915724 Content-Disposition: form-data; name="ordner" 100 -----------------------------265001916915724 Content-Disposition: form-data; name="submit" Daten absenden -----------------------------265001916915724-- HTTP/1.x 200 OK Date: Sun, 07 Feb 2010 17:34:21 GMT Server: Apache/2.2.14 (EL) X-Powered-By: PHP/5.2.11 Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=ISO-8859-1 ----------------------------------------------------------
Bisher habe ich diesen VB-Code:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
Dim boundary As String = "---------------------------" & DateTime.Now.Ticks.ToString Dim req As HttpWebRequest = HttpWebRequest.Create("http://umbdata.esport-masters.com/") req.Credentials = System.Net.CredentialCache.DefaultCredentials req.ServicePoint.Expect100Continue = False req.Method = "POST" req.KeepAlive = True req.ContentType = "multipart/form-data; boundary=" & boundary req.Referer = "http://umbdata.esport-masters.com/" req.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7" req.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" Dim boundarybytes() As Byte = System.Text.Encoding.ASCII.GetBytes(("--" + boundary & Environment.NewLine)) Dim infobytes() As Byte = System.Text.Encoding.ASCII.GetBytes("Content-Disposition: form-data; ""name=""datei""; ""filename=""mitschnitt.txt""; ""name=""passwort""; ""passwort=""EsportMastersUmbrella2010-02""; ""name=""ordner""; ""tmp_name=""100""" & Environment.NewLine & "Content-Type: text/plain" & Environment.NewLine & Environment.NewLine) req.ContentLength = boundarybytes.Length + infobytes.Length Dim fileinfo As New FileInfo(My.Computer.FileSystem.SpecialDirectories.Desktop & "/mitschnitt.txt") req.ContentLength += fileinfo.Length Dim reqstream As Stream = req.GetRequestStream 'schreiben reqstream.Write(boundarybytes, 0, boundarybytes.Length) reqstream.Write(infobytes, 0, infobytes.Length) Dim FileStream As FileStream = File.Open(My.Computer.FileSystem.SpecialDirectories.Desktop & "/mitschnitt.txt", FileMode.Open) Dim buffer(1024) As Byte Dim bytesRead As Integer Do bytesRead = FileStream.Read(buffer, 0, buffer.Length) reqstream.Write(buffer, 0, bytesRead) Loop Until bytesRead = 0 FileStream.Close() reqstream.Close() Dim resp As HttpWebResponse = req.GetResponse
Jedoch funktioniert es leider nicht, es wird keine Datei hochgeladen. Was habe ich falsch gemacht?
MfG
Markus
## EDIT ##
Unter Umständen könnte man es ja auch so irgendwie machen:
Code :1 2 3
WebBrowser1.Document.GetElementById("passwort").InnerText = "EsportMastersUmbrella2010-02" WebBrowser1.Document.GetElementById("ordner").InnerText = "100" WebBrowser1.Document.GetElementById("submit").InvokeMember("click")
Nur ich weiß nicht, wie ich da die Datei aussuchen kann.
MfG
Ähnliche Themen
-
Upload-Skript für große Datenmengen
Von DrBonsai im Forum PHPAntworten: 10Letzter Beitrag: 19.03.10, 07:57 -
Upload-Skript
Von nordi im Forum PHPAntworten: 1Letzter Beitrag: 24.11.09, 01:37 -
PHP-Upload Skript
Von blck im Forum PHPAntworten: 10Letzter Beitrag: 25.06.09, 17:11 -
Problem mit Upload-Skript
Von Fabian Frank im Forum PHPAntworten: 3Letzter Beitrag: 25.05.06, 16:21 -
Schon wieder, upload skript -.-
Von Kimahri im Forum PHPAntworten: 5Letzter Beitrag: 23.02.06, 19:24





Zitieren
Login





