I've changed it back to where the media file goes last and I still get that error so if anybody has an idea of what I'm doing wrong there I would appreciate it.

On 1/19/2010 4:54 AM, Rich wrote:
I've discovered the same thing, it seems TwitVid is doing some weird
manual parsing of variables and/or HTTP headers and everything needs
to be exactly spaced as they would expect it.

I had to tweak almost everything that works for other services to get
it to work with TwitVid.

On Jan 18, 9:03 pm, John Meyer<john.l.me...@gmail.com>  wrote:
I'm part of the TwitterVB library project. Part of my effort is to write
an object that encapsulates a connection to TwitVid.com  I'm currently
testing the upload function but am having problems:

      Upload = String.Empty

              If DateTime.Now>  m_dtTL Then
              End If
                  Dim bMovieFile() As Byte =
                  Dim strBoundary As String = Guid.NewGuid.ToString()
                  Dim strHeader As String = String.Format("--{0}",
                  Dim strFooter As String = String.Format("--{0}--",
                  Dim rqUpload As HttpWebRequest =
DirectCast(WebRequest.Create(TWITVID_UPLOAD_URL), HttpWebRequest)
                  With rqUpload
                      .PreAuthenticate = True
                      .AllowWriteStreamBuffering = True
                      .ContentType = String.Format("multipart/form-data;
boundary={0}", strBoundary)
                      .Method = "POST"
                  End With
                  Dim strFileType As String = "application/octet-stream"

                  Dim strFileHeader As String =
[String].Format("Content-Disposition: file; name=""{0}"";
filename=""{1}""", "media", p_strFileName)
                  Dim strFileData As String =
                  Dim strContents As New StringBuilder()
                  With strContents

                      .AppendLine([String].Format("Content-Type: {0}",
form-data; name=""{0}""", "token"))
form-data; name=""{0}""", "message"))

                  End With

                  Dim bContents() As Byte =
                  rqUpload.ContentLength = bContents.Length

                  Dim rqStreamFile As Stream = rqUpload.GetRequestStream()
                  rqStreamFile.Write(bContents, 0, bContents.Length)
                  Dim rspFileUpload As HttpWebResponse =
DirectCast(rqUpload.GetResponse, HttpWebResponse)
                  Dim rdrResponse As New
                  Dim strResponse As String = rdrResponse.ReadToEnd()
                  Dim xResponse As New XmlDocument
                  Dim xnRSP As XmlNode = xResponse.SelectSingleNode("//rsp")
                  If xnRSP.Attributes("stat").Value = "ok" Then
                      Upload = xnRSP.SelectSingleNode("//mediaurl").InnerText
                      Upload = strResponse

                  End If

              Catch ex As Exception
              End Try
              Return Upload

          End Function

Calling this function gives me this error:

<?xml version="1.0" encoding="UTF-8"?>
<rsp stat="fail">

<err code="1002" msg="No file specified to upload" />

if anybody has any ideas I'd appreciate it (note I've put the file on
the front and in the back. Both return the same error).

Reply via email to