I'm trying to upload a file to my PHP form on my website. I have no idea how to go about this. I'm sure I need to break down the file into a transferable form, I'm not sure where to go about this. Then I need to send an HTTP request to it, but I'm not sure either.

The website I'm uploading to is: http://download.dab-media.com/
I know the upload isn't perfect, but I just wanted to do it for learning purposes, and this shall extend my learning purposes yet. :)

I've searched Google all over, and can't seem to find anything that works, or is just too confusing to setup. :\
Any links, or anything will be helpful.
Thanks!
dab.

Oh snap, I forgot to tell you why its in the vb.net section. I'm trying to make an application upload an image to my php form, from the application. Such as the user selects an image, and the application will upload the image to the website.
I've looked through Google, and found some code to connect to a page, however, I'm not sure how to "upload" the image to the page. I've looked, and found a thing talking about converting it to bytes or something... Not 100% sure to do here. :\

Private Shared Sub start_post()
        'Our postvars
        Dim buffer As Byte() = Encoding.ASCII.GetBytes("test=postvar&test2=another")
        'Initialisation, we use localhost, change if appliable
        Dim WebReq As HttpWebRequest = DirectCast(WebRequest.Create("http://download.dab-media.com/test.php"), HttpWebRequest)
        'Our method is post, otherwise the buffer (postvars) would be useless
        WebReq.Method = "POST"
        'We use form contentType, for the postvars.
        WebReq.ContentType = "application/x-www-form-urlencoded"
        'The length of the buffer (postvars) is used as contentlength.
        WebReq.ContentLength = buffer.Length
        'We open a stream for writing the postvars
        Dim PostData As Stream = WebReq.GetRequestStream()
        'Now we write, and afterwards, we close. Closing is always important!
        PostData.Write(buffer, 0, buffer.Length)
        PostData.Close()
        'Get the response handle, we have no true response yet!
        Dim WebResp As HttpWebResponse = DirectCast(WebReq.GetResponse(), HttpWebResponse)
        'Let's show some information about the response
        Console.WriteLine(WebResp.StatusCode)
        Console.WriteLine(WebResp.Server)

        'Now, we read the response (the string), and output it.
        Dim Answer As Stream = WebResp.GetResponseStream()
        Dim _Answer As New StreamReader(Answer)
        Console.WriteLine(_Answer.ReadToEnd())

        'Congratulations, you just requested your first POST page, you
        'can now start logging into most login forms, with your application
        'Or other examples.
    End Sub

So thanks everyone for your time, hope to find an answer :)
Cheers!

You're confusing yourself, that's why you can't find anything on google.

If you have a VB application that needs to upload something to a server, the the vb application needs to connect to the server, and upload it on its own. It has nothing to do with a php web form.

You can have a SEPARATE php web form that can upload images to the same place, but they will never interact -- they are two different programs doing basically the same thing.

So what you're looking for is kind a mini FTP client in VB. Google that instead.

Thing is, I don't want to use FTP to connect, or, I'd rather not since I already have all the file restriction things I need. I was hoping I could connect to it with VB and simulate a browser uploading to it. :/

This article has been dead for over six months. Start a new discussion instead.