NetTalk Central
September 05, 2010, 05:49:52 pm
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
: Welcome to the NetTalk Central Forums!
Home
Help
Search
Login
Register
NetTalk Central
>
The Rest Of NetTalk
>
The Rest - Share Knowledge
>
Posting a file to a web site
Pages: [
1
]
« previous
next »
Print
Author
Topic: Posting a file to a web site (Read 1662 times)
seanh
Newbie
Posts: 2
Posting a file to a web site
«
on:
October 18, 2007, 09:15:12 pm »
The docs posting for a file only mention this in passing.
For multi part mime message, ie a file, you need to add '--' in front of the boundary string!
Hopefully this will save someone the 2 hours it took me find this.
Here is some code that works:
FileLen = ReadFileToString('WebProducts.csv',FileContents)
WebURL = 'http://' & clip(config:website) & '/admin/au_addproductsupload.php'
PostString = '--' & Boundry & CRLF |
& 'Content-Disposition: form-data; name="localproductsfile"; filename="WebProducts.csv"' & CRLF |
& 'Content-Type: application/octet-stream' & CRLF |
& CRLF |
& fileContents[1:filelen] |
& CRLF |
& '--' & Boundry & CRLF |
& 'Content-Disposition: form-data; name="Submit"' & CRLF |
& CRLF |
& 'Submit'& CRLF |
& '--' & Boundry & '--' & CRLF |
ThisWebClient.SetAllHeadersDefault() ! We recommend you call this before Fetch()
! You may want to modify some properties after this.
ThisWebClient.CanUseProxy = 1 ! Can use a proxy
ThisWebClient.ProxyServer = 'localhost' ! Debug
ThisWebClient.ProxyPort = 81 ! Debug
ThisWebClient.HeaderOnly = 0
!ThisWebClient.Cookie = Cookie
!ThisWebClient.Referer = Referer
ThisWebClient.ContentType = 'multipart/form-data; boundary=' & Boundry
ThisWebClient.AcceptEncoding = ''
ThisWebClient.ContentLength = Len(Clip(PostString))
ThisWebClient.Pragma_ = 'no-cache'
ThisWebClient.AsyncOpenUse = 1 ! Use AsyncOpen 12 seconds (recommended)
ThisWebClient.AsyncOpenTimeOut = 2000 ! up to 12 seconds to connect
ThisWebClient.InActiveTimeout = 9000 ! Set IdleTimeout 90 seconds
!ThisWebClient.Post(WebURL,PostString)
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
News and Announcements
-----------------------------
=> News And Views
=> Your Views and Comments
-----------------------------
NetTalk Web Server
-----------------------------
=> Web Server - Ask For Help
=> Web Server - Share Knowledge
-----------------------------
NetTalk E-Mail
-----------------------------
=> E-Mail - Ask For Help
=> E-Mail - Share Knowledge
-----------------------------
NetTalk FTP
-----------------------------
=> FTP - Ask For Help
=> FTP - Share Knowledge
-----------------------------
NetTalk Chat
-----------------------------
=> Chat - Ask For Help
=> Chat - Share Knowledge
-----------------------------
The Rest Of NetTalk
-----------------------------
=> The Rest - Ask For Help
=> The Rest - Share Knowledge
-----------------------------
NetTalk Talent Pool
-----------------------------
=> Looking To Hire
=> Available For Hire
Loading...