Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #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 Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,827 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 22 h 57 m 29 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
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 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,336 Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level)Scorpions4ever User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 4 Weeks 12 h 46 m 43 sec
Reputation Power: 674
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)


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway