Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 25th, 2002, 03:04 AM
WhoMe WhoMe is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 3 WhoMe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Cool Http file upload (Post)

Does anyone know how to upload a file and form data
to a server?

What i want to do is allow a user to upload a file and form data
to my php script so i can process it. So of course FTP would be
no good.

I can do this with the XMLHTTP control but it does not thread and
it pretty lame. Surely you can do it with winsock or Inet

Any ideas?

Source code would be greatly appreciated.
Comments on this post
Gran Roguismo agrees!

Reply With Quote
  #2  
Old October 25th, 2002, 01:20 PM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed God (5000 - 5499 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 5,163 Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level)Onslaught User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 6 Days 1 h 34 m 20 sec
Reputation Power: 791
Just a stupid question from me, but why not just have the user access the php page through a browser?

Another possible solution would be to use sockets but I have no code for you on that, the MSDN library might have some examples for you though.

Reply With Quote
  #3  
Old October 25th, 2002, 09:29 PM
WhoMe WhoMe is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 3 WhoMe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
re: Http File uload (Post)

Sorry forgot to mention, i have a VB program that the user uses and then they submit the info to the server. (a file and form fields)

Here is the URL for the XMLHTTP method
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=6076&lngWId=1
Comments on this post
Gran Roguismo agrees!

Reply With Quote
  #4  
Old October 26th, 2002, 02:01 AM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,387 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 21 h 39 m 3 sec
Reputation Power: 4080
Try using the Webbrowser control from Microsoft Internet Controls to do your stuff. That's what I usually use, with code something like this:
Code:
   Dim bPostData() As Byte
   Dim sHeaders As String

   sPost = "foo=1&bar=test&quux=42"  ' Post data
   sHeaders = "Content-Type: application/x-www-form-urlencoded" & vbCrlf ' Add extra headers as needed
   ReDim bPostData(Len(sPost))
   bPost = StrConv(sData, vbFromUnicode)
   WebBrowser.Navigate sURL, 0, vbEmpty, bPostData, sHeaders
    (or)
   WebBrowser.Navigate2 sURL, 0, vbEmpty, bPostData, sHeaders

If you want to use a GET method instead of POST, then simply remove the extra params from the call and use WebBrowser.Navigate sURL or WebBrowser.Navigate2 sURL instead. I just put the above code together off the top of my head and haven't checked it to see if it actually works, but the syntax should be pretty close.

Hope this helps!

Last edited by Scorpions4ever : October 26th, 2002 at 02:05 AM.

Reply With Quote
  #5  
Old October 26th, 2002, 06:43 PM
WhoMe WhoMe is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 3 WhoMe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
That method only works with Text files.

Klemens Schmid has some source on how to send a text file
using that method.

http://www.schmidks.de/files/HttpUpload2.zip

It works great but i get a weird error every second time i send
to the server.
The error is this:

Method Not Implemented
--AaB03x to / not supported.
Invalid method in request --AaB03x

The server is running Apache 1.3.26 (a freebie server)

Any ideas why it does this?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Http file upload (Post)

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap