Hello friends , i need help i need to create a very simple program to upload images to a website ! Like there will be a simple "BROWSE" button and 1 URL text bar ... we just need to select the image and it will upload the images to a site and give us the url of the image ... the website where i need to upload images is : www.upfoto.in simple program to upload images to this site and give me a url Please HELP!
Hi, First of all I need to say that you have pick a wrong way - if you want to sell this program or make it free and popular, you should buy your own hosting for storing uploaded images. It wont cost you a lot but you will have full control and, eventually, start making money out of it But, if you want to use upfoto.in then you still can do a good job To make this work you need to: -Find out how http request for posting image should look like. You can do this using tools like Firebug and inspect Net->HTML section. I did this for you and I found that you need to make a POST http request, passing just one parameter called "url". That parameter should contains binary data - picture you want to upload. Now, how you can do this via Visual Basic? You need to create HttpRequest object and set it up properly. Something like this: Dim request as WebRequest = WebRequest.Create("http://www.upfoto.in/") request.Credentials = CredentialCache.DefaultCredentials request.Method = "POST" request.ContentLength = yourImageConvertedToBinaryArray.Length request.ContentType = "multipart/form-data" Stream dataStream = request.GetRequestStream () //here you add your image to the request dataStream.Write ("url=" + yourImageConvertedToBinaryArray, 0, yourImageConvertedToBinaryArray.Length) Code (markup): etc... Note thtat yourImageConvertedToBinaryArray is variable that contains binary data of image you want to upload. If you dont know how to read image from hard drive and convert it to the binary data please google "VB how to read image" and "VB convert image to binary data". Also to get help with http request see http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.method.aspx and http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.method.aspx Now, your image can be uploaded. Next step is to find out URL of the image. You will notice that when you make a http request, you get get it http response. That response contains HTML returned from the server. You will need to parse that response text and find the image url. I suggest you to use regular expressions to find segment with URL of your image.