Hi,
I'm trying to get the Scribd API to work from ASP code. All works
fine, except uploading a file.
I tried the UploadFromURL method, bt that does not work so great, so
I'm trying to get the upload method to work:
I have a simple form in test.asp:
<FORM id=uploadform METHOD=POST enctype="multipart/form-data"
ACTION="test2.asp" >
<INPUT type="hidden" name="method" id="method" value="docs.upload">
<INPUT type="hidden" name="api_key" name="api_key"
value="xxxxxxxxxxxxxxxxxxx">
<INPUT type=file name="file" id="file">
<input type=submit>
</form>
If I fill in
http://api.scribd.com/api as the action target there is
no problem, the file uploads and gets converted, but obviously I want
to get the result back and parse it, so I coded the following in
test2.asp
bytecount = request.totalbytes
requestbin = request.BinaryRead(bytecount)
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "POST", "
http://api.scribd.com/api", false
xmlhttp.setRequestHeader "Content-Type", "MULTIPART/FORM-DATA"
xmlhttp.setRequestHeader "Content-Length", bytecount
xmlhttp.send requestbin
Response.write xmlhttp.responseText
set xmlhttp = nothing
I tried using different versions of the object, I tried converting the
binary request to a string but al i get is :
500 Internal Server Error
If I print the converted data (basically what I'm sending) I get the
following:
-----------------------------21015113118230 Content-Disposition: form-
data; name="method" docs.upload
-----------------------------21015113118230 Content-Disposition: form-
data; name="api_key" xxxxxxxxxxxxxxx
-----------------------------21015113118230 Content-Disposition: form-
data; name="file"; filename="British_health_hazards_0.89.doc" Content-
Type: application/msword ÐÏ à¡± á
can anyone tell me what I can do to get something else than "internal
server error" ??