Hi all,
I am aware of many RB examples regarding uploading a file to a php
script on a web server however I am wondering if anyone has any tips
or examples regarding uploading a file from a web page to a RealBasic
built web server.
If simply receiving a GET then the following works well to detect
when the request has been received:
if InStrB( LookAhead(), chr(13) + chr(10) ) = 0 then return
However when receiving a POST containing a file being uploaded there
may be more than one chr(13)+chr(10) - I am wondering if someone
could suggest a better way to detect when the entire request and file
have been received.
Here is an example file upload request - including headers and file:
POST /upload.dt HTTP/1.1
Accept: */*
Accept-Language: en
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/
418.8 (KHTML, like Gecko) Safari/419.3
Content-Length: 1389
Content-Type: multipart/form-data; boundary=----------0xKhTmLbOuNdArY
Connection: keep-alive
Host: localhost:7777
------------0xKhTmLbOuNdArY
Content-Disposition: form-data; name="datafile";
filename="bigsmile3.gif"
Content-Type: image/gif
file content is inserted here
------------0xKhTmLbOuNdArY--
...and here is the form I am using to upload the file:
<form action="http://localhost:7777/upload.dt"
enctype="multipart/form-data" method="post">
<p>
Please specify a file, or a set of files:<br>
<input type="file" name="datafile" size="40">
</p>
<p>
<input type="submit" value="Send">
</p>
</form>
_______________________________________________
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>