Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Send multipart form data. (Send strings and a file)

multipart form data send strings php vb.net

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1 LegacyDash

LegacyDash

    CC Lurker

  • New Member
  • Pip
  • 8 posts

Posted 21 February 2014 - 06:57 AM

Hai.

So I've been ** around in VB.NET - and ran into a major roadblock...

 

I have a PHP script that I want to upload an image, and some strings to, and I wanna do it all in one request.

 

How can I send multiple strings and a file in one HTTP request, and then receive the servers response?

 

So far I've just been looking on Stackoverflow for help - but to no avail.

 

Also, this is in Visual Basic .NET - not C#, but even a good C# article or tutorial would help to some extent.

 

Thanks.

:irritated:



#2 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts

Posted 21 February 2014 - 10:17 AM

Just to be clear: You want to use VB.NET to fill a php form, right?

 

If so, it's likely for you to use Webclient ( you could use WebBrowser if you wouldn't want to upload an image, well you could do that too in WB but it's... a ravelly thing to do)

 

Well, you will need to:

. take the PHP page and take note of the elements to post (as in the name of the fields where the data is)

. take note of the form action page (to send such)

. Construct that response via Weblient

. Call the form action page with that :P



#3 LegacyDash

LegacyDash

    CC Lurker

  • New Member
  • Pip
  • 8 posts

Posted 21 February 2014 - 05:23 PM

Just to be clear: You want to use VB.NET to fill a php form, right?

 

If so, it's likely for you to use Webclient ( you could use WebBrowser if you wouldn't want to upload an image, well you could do that too in WB but it's... a ravelly thing to do)

 

Well, you will need to:

. take the PHP page and take note of the elements to post (as in the name of the fields where the data is)

. take note of the form action page (to send such)

. Construct that response via Weblient

. Call the form action page with that :P

The problem with that is I need to send x-form-multipart data, not not standard post data.

I can't send files over the normal post method.

 

Also, the PHP script is done (well actually it isn't but I'm good with the PHP side of things).



#4 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts

Posted 22 February 2014 - 06:23 AM

Now we are talking!

 

Here is an easy example

 

For posting more than one file you should just .Add them to the POST request.






Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download