Specifying file in POST command

I am using pub.client.http to POST a file to a partner’s website. Their page is set up to accept POSTed files when the request resembles:

[FONT=Courier][SIZE=2]2009-04-03 15:01:16 SOMEINFORMATION ip.add.r.ess
POST /path/file.txt - 446…

When I use the post service, it generates the request like:

2009-04-03 15:01:16 SOMEINFORMATION ip.add.r.ess
POST /path - 446…

when I give the url as http://site.com/path
or as

2009-04-03 15:01:16 SOMEINFORMATION ip.add.r.ess
POST / - 446…

when I just give it http://site.com

My question–what parameter do I need to feed to the pub.client.http service to get it to populate the filename after the POST / ?


Try setting your method to put instead of post, include the filename in the URL, loadAs bytes, map your file content into data/bytes. that usually works for me. stream works as well.

Thanks griffima. That is how we have done it in the past as well. The problem with this one is that I actually do not have a “file” that I am sending, but rather I am building a string in wM which then I want to Post/Put (don’t care which) to the site. Since it’s not yet a file, it doesn’t have a name to send with it.

The put method I was describing is not actually sending a real file right, just content being passed by the IS, happens to be bytes in this case but its not a real file until written out on the other end. The put tells it to treat the URL as a file name as you know. More efficient that post for uploading files assuming the web server you are putting to supports it.

Not sure I understand that comment. Why don’t you have a name to pass via the URL? If it is a variable you are creating on the fly you still would just append it to the end of your URL.

I actually didn’t realize the filename needed to be part of the url when doing a put instead of a post. Thank you for your help!