Hello,
I'm trying to write a script that uses xmlhttp to post a file to a form and once submitted the form uploads the file entered in the textbox. The page requires HTTPS and a login and password. I can login find and do a get and it returns the html of the page. The problem is when I submit the file I get an error from response.text saying an error has occured during the file upload. When I look at the web server logs it sees the file im trying to upload but returns an error 302. i think the error 302 is complaining about frames on the page and ie doesnt know how to handle it. If anyone has any ideas it would be a great help. I posted my code and error 302 below:
sub send_to_sdx(file_to_send)
Dim objSrvHTTP
Dim strHTML, sHttpArray, strDateHold, strDate, pos1, pos2
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
Const adSaveCreateNotExist = 1
set http = CreateObject("Microsoft.XMLHTTP")
err.clear
http.open "GET","
https://sdx.mydomain.com/tmp/", FALSE, "username", "password"
http.send
if Err.number = 0 and http.status = 200 then
strHTML = http.responseText
set xml = CreateObject("Microsoft.XMLHTTP")
xml.Open "POST","
https://sdx.mydomain.com/tmp/", FALSE, "username", "password"
xml.setRequestHeader "Content-Type", "text/xml"
xml.Send "upload_file="&file_to_send
wscript.echo Err.number
wscript.echo xml.status
wscript.echo xml.statustext
wscript.echo xml.responseText
end if
end sub
output
0
200
OK
<html>
<head><title>Data Exchange Service</title></head>
<body background=images/bkgrd_pg.gif>
<table border=0 width=100%>
<tr align=left>
<td><pre> </pre></td>
<td>
<img src=images/logo.gif>
<h2 align=center>Data Exchange Service</h2>
<p align=center>Access by unauthorized users is prohibited.</p>
<br clear=all>
<h3>File Upload Error</h3>
An error has occurred during the file upload:<p>
<p><a href=index.cgi>Return to file transfer area</a>
</td></tr>
</table>
</body>
</html>
Web Server Log Error
[prd:etus:web:sdx:sdx2m3] grep username access
10.9.153.35 - - [05/Sep/2006:13:36:13 -0700] "GET /tmp?upload_file=C:\Documents%20and%20Settings\username\Desktop\filename060905.txt HTTP/1.1" 302 0
[prd:etus:web:sdx:sdx2m3]
Error 302 Looks like "302" is redirect error based on Google search.