Jump to content

Error with a MsgBox in HTTP.au3


chachew
 Share

Recommended Posts

So this was not written by me and i honestly am not sure who wrote it...

The problem i get is with a MsgBox and it seems to have an undefined array in it but im not exactly sure how to resolve it. Code snippet that creates error

Func _FileUpload()
$host = "your.server"
$port = "80"
$page = ""
$vars = "action=upload"
$url = $page&"?"&_HTTPEncodeString($vars)
$socket = _HTTPConnect($host, $port)
$get = _HTTPPost_File($host,$url,$socket,@DesktopDir & "\" & $fileName , "uploadedfile")
$recv = _HTTPRead($socket,1)
MsgBox(0, "Info", "Data received:" & @CRLF & $recv[4] & @CRLF)
EndFunc ;==>End fileupload

When MsgBox(0, "Info", "Data received:" & @CRLF & $recv[4] & @CRLF) is commented out no problems but when its running in the code i get error below:

MsgBox(0, "Info", "Data received:" & @CRLF & $recv[4] & @CRLF)

MsgBox(0, "Info", "Data received:" & @CRLF & $recv^ ERROR

Now $recv[4] is an array correct? but it was never declared as a variable, any suggestions

Link to comment
Share on other sites

#include <Array.au3> then use _ArrayDisplay($recv) to see what's in the array.

Or change the _HTTPRead($socket, 1) to use a flag of 0 then change your MsgBox() to use $recv instead of $recv[4].

Also, where'd you get the UDF? It might be old and needs some updating. I wish I could give you more but I'm not too familiar and have never used it. Good luck.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...