--- Christian Leicht <[EMAIL PROTECTED]> wrote:
> But the syntax on RB is strange. Here is the code thats > working. Only > with the name of the file and the binary of the file. i have > testet a > lot of things bringing more variables to it, but it does not > work. > > // Added to support progress dialog > myPostSocket.myTask = me > me.TaskMaximum = fileToUpload.Length ' bytes being uploaded > me.TaskProgress = 0 > me.TaskDescription = "Uploading " + fileToUpload.Name + > "..." > > Dim data, rawdata, nl, encodedFileName,funktion As String > Const boundary = "--------0xKhTmLbOuNdArY" > > nl = chr(13) + chr(10) ' CRLF, used as MIME end-of-line > character > > // Step 1: get file data in uploadable form > Dim bs As BinaryStream > bs = fileToUpload.OpenAsBinaryFile > rawdata = bs.Read(fileToUpload.Length) ' gulp! > > // Debugging step... > EF_Result.SelText = "Uploading " + > FormatLen(fileToUpload.Length) + " > bytes..." + EndOfLine > EF_Result.SelStart = 9999999 > > encodedFileName = EncodeURLComponent(fileToUpload.Name) ' > convenience Have a look at this section: > data="--" + boundary + nl > data = data + _ > "Content-Disposition: form-data; name=""userfile""" + nl > + nl + _ > encodedFileName + nl This uploads the equivalent of an HTML <input> field named "userfile". To upload more data, repeat this section with different values for the "name=" part and the encodedFileName variable. Also, repeat it with "name=""bildbinary""" and the encodedFileName for the file you are uploading, immediately before you call this next section: > data = data + "--" + boundary + nl > > > data = data + _ > "Content-Disposition: form-data; name=""bildbinary""; > filename=""" + _ > encodedFileName + """" + nl +_ > "Content-Type: image/jpeg" + nl + _ > "Content-Length: " + FormatLen(lenb(rawdata)) + nl + _ > "Content-Transfer-Encoding: binary" + nl + _ > nl + rawdata + nl I think that's needed to get the file to "sync" correctly with the file name (or at least, I noticed that the commercial web browsers send the data this way). The rest of your code should be good as written. Mark Nutter Quick and easy regex creation and debugging! http://www.bucktailsoftware.com/products/regexplorer/ __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html>
