Re: [twitter-dev] Uploading a Profile Image help
Also a reminder: the Twitter API is at the http://api.twitter.com subdomain. Twitter API has version numbers in the URL as well. The original poster in this thread is using http://twitter.com/account/update_profile_image.xml when they should be using http://api.twitter.com/1/account/update_profile_image.xml And I'll echo what Tom has said: you should switch to using OAuth very soon or you'll find your script doesn't work at all in about 2 weeks. Taylor On Sun, Aug 8, 2010 at 10:28 PM, Raghu Prasad prasad.ragh...@gmail.comwrote: On Sun, Aug 8, 2010 at 5:58 AM, marketingmaniac execut...@gmail.com wrote: i use to have this app that suddenly doesn't work anymore,, it use to work perfectly and now ,, hmm,, any help would be appreciated,, Though I don't know a bit about VB, I can safely say that profile image functionality of Twitter has been broken for many weeks. Updating profile image has not been working via API. If you check the past threads, you'd find that one of the Twitter developer is assigned the task of streamlining the image upload functionality. I am also waiting for that to happen. Raghu here is the code that update my users profile written in vb 2008/10 that worked flawlessly 'THE BUTTON I MADE TO INITIATE THE SUB CALLED UPLOADPROFILEIMAGE Private Sub Button37_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button37.Click
Re: [twitter-dev] Uploading a Profile Image help
On Sun, Aug 8, 2010 at 5:58 AM, marketingmaniac execut...@gmail.com wrote: i use to have this app that suddenly doesn't work anymore,, it use to work perfectly and now ,, hmm,, any help would be appreciated,, Though I don't know a bit about VB, I can safely say that profile image functionality of Twitter has been broken for many weeks. Updating profile image has not been working via API. If you check the past threads, you'd find that one of the Twitter developer is assigned the task of streamlining the image upload functionality. I am also waiting for that to happen. Raghu here is the code that update my users profile written in vb 2008/10 that worked flawlessly 'THE BUTTON I MADE TO INITIATE THE SUB CALLED UPLOADPROFILEIMAGE Private Sub Button37_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button37.Click
[twitter-dev] Uploading a Profile Image help
i use to have this app that suddenly doesn't work anymore,, it use to work perfectly and now ,, hmm,, any help would be appreciated,, here is the code that update my users profile written in vb 2008/10 that worked flawlessly 'THE BUTTON I MADE TO INITIATE THE SUB CALLED UPLOADPROFILEIMAGE Private Sub Button37_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button37.Click Dim photo As Byte() photo = IO.File.ReadAllBytes(Me.jpg) UploadProfileImage(photo, username:=(AnaisAlice20), pwd:=(pass99)) End Sub 'THE SUB WHICH THE BUTTON CALLED Public Shared Sub UploadProfileImage(ByVal photo As Byte(), ByVal username As String, ByVal pwd As String) 'photo is just a byte array of the image data 'Dim photo As Byte() photo = IO.File.ReadAllBytes(c:\me.jpg) Dim request As HttpWebRequest = DirectCast(HttpWebRequest.Create(http://twitter.com/account/ update_profile_image.xml), HttpWebRequest) System.Net.ServicePointManager.Expect100Continue = False request.PreAuthenticate = True request.AllowWriteStreamBuffering = True Dim boundary As String = System.Guid.NewGuid().ToString() request.Credentials = New NetworkCredential(username, pwd) request.ContentType = String.Format(multipart/form- data;boundary={0}, boundary) request.Method = POST ' Build Contents for Post Dim header As String = -- boundary Dim footer As String = -- boundary -- Dim contents As New StringBuilder() ' Image contents.AppendLine(header) contents.AppendLine(String.Format(Content-Disposition:form- data); name=image); filename={0}, twitterProfilePhoto.jpg)) contents.AppendLine(Content-Type: image/jpeg) contents.AppendLine() contents.AppendLine(System.Text.Encoding.GetEncoding(iso-8859-1).GetString(photo)) ' Footer contents.AppendLine(footer) ' Data that is sent with the post Dim bytes As Byte() = Encoding.GetEncoding(iso-8859-1).GetBytes(contents.ToString()) request.ContentLength = bytes.Length Using requestStream As Stream = request.GetRequestStream() requestStream.Write(bytes, 0, bytes.Length) requestStream.Flush() requestStream.Close() ' Using response As WebResponse = request.GetResponse() 'Using reader As New StreamReader(response.GetResponseStream()) 'Dim s As String = reader.ReadToEnd() 'End Using 'End Using End Using End Sub