| | |
Upload file via PHP upload form.
Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2008
Posts: 3
Reputation:
Solved Threads: 0
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.
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.
Post your question on PHP Section. This section just for VB.Net
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
•
•
Join Date: Jun 2008
Posts: 3
Reputation:
Solved Threads: 0
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. :\
So thanks everyone for your time, hope to find an answer 
Cheers!
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. :\
vb.net Syntax (Toggle Plain Text)
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

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.
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.
![]() |
Similar Threads
- how to retrive image file from mysql databse using php (PHP)
- Sending pic attachments via PHP form (PHP)
- hyperlink and upload in PHP (PHP)
- How to upload a file in PHP ? (PHP)
- Upload file without User Interaction (PHP)
- Specify File type (PHP)
- PHP - how does it work? (PHP)
- Please help!!! Upload script.. (PHP)
- php error HELP!!! (PHP)
Other Threads in the VB.NET Forum
- Previous Thread: Help with PocketPC App and Database Needed
- Next Thread: manipulate the data in the database
Views: 2758 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
"crystal .net .net2005 30minutes 2008 access add application array assignment basic binary box button buttons center code connectionstring convert cpu data database databasesearch datagrid datagridview design designer dissertation dissertations dissertationthesis dll dosconsolevb.net editvb.net employees error excel exists firewall folder function image images isnumericfuntioncall listview login math memory mobile module msaccess mssqlbackend mysql navigate net opacity page pan peertopeervideostreaming picturebox plugin port print printing printpreview problem record refresh reports" reuse save savedialog search serial sorting sql sqldatbase storedprocedure string structures studio temp textbox timer upload useraccounts usercontrol vb vb.net vb.netcode vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet vista visual visualbasic visualbasic.net visualstudio2008 web wpf xml






