Hi, this problem has made me really angry by wasting my whole day trying to figure it out.
My VB.NET server, which is running on my computer (which is portforwarded and definately works) is made from this code (just showing relevant parts):
Do
Dim response As HttpListenerResponse = Nothing
Try
Dim context As HttpListenerContext = listener.GetContext()
response = context.Response
Dim responseString As String = Nothing
Dim bytes = Nothing
Dim WholeUrl As String = context.Request.Url.ToString
Dim Host As String = "http://" & Label1.Text & ":8080/"
Dim UrlRequested As String = Replace(WholeUrl.ToLower, Host, Nothing)
With UrlRequested
If .EndsWith(".html") Then
response.ContentType = "text/html"
Else
response.ContentType = "text/php"
End If
bytes = IO.File.ReadAllBytes("C:\Users\Rixterz\Desktop\FTP Stuff\" & .ToString)
End With
Dim buffer() As Byte = bytes
response.ContentLength64 = buffer.Length
Dim output As System.IO.Stream = response.OutputStream
output.Write(buffer, 0, buffer.Length)
Catch ex As Exception
Finally
If response IsNot Nothing Then
response.Close()
End If
End Try
Loop
The folder C:\Users\Rixterz\Desktop\FTP Stuff contains UploadFile.html:
<html>
<head>
<title>File Upload Form</title>
</head>
<body>
This form allows you to upload a file to the server.
<form action="get_file.php" method="post">
Type (or select) Filename: <input type="file" name="uploadFile">
<input type="submit" value="Upload File">
</form>
</body>
</html>
and also get_file.php:
<html>
<head>
<title>Process Uploaded File</title>
</head>
<body>
<?php
move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'],
"./uploads/{$_FILES['uploadFile'] ['name']}")
?>
</body>
</html>
Nothing shows up when "Upload File" is clicked, and a full system search of the 'uploaded' file returns nothing. Please help.
-Rixterz