Sign in to follow this  
Followers 0
YoseMite

Upload files

3 posts in this topic

Hey,

I want upload a JPEG picture to my webserver.

But the FTP script of Wouter doesn't work... :(

I've got a error on line 73:

Return $ai_FTPPut[File[0]

Reurn $ai_FTPPutFile^ERROR

Error: Subscript used with non-Array variable.

Line 73: Return $ai_FTPPutFile[0]

The rest of my code:

#include <FTP.au3>
$server = 'ftp.account.be'
$username = 'webmaster#account.be'
$pass = 'mypass'

$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $server, $username, $pass)
$Ftpp = _FtpPutFile($Conn, 'C:\image.jpg', '/www/image.jpg')
$Ftpc = _FTPClose($Open)

FTP.au3

Share this post


Link to post
Share on other sites



Return $ai_FTPPut[File[0]

Reurn $ai_FTPPutFile^ERROR

Error: Subscript used with non-Array variable.

I have'nt used wouters script yet, so I don't really know. But, according to the help file:

If the function call fails then @error is set to 1. Otherwise an array is returned that contains the function return value and a copy of all the parameters (including parameters that the function may have modified).

So I guess, the function call failes for some reason (maybe wrong FTP-or File-path or missing write permissions), so the return value of DllCall is NOT an array. Accessing that non-existant array will cause the script to fail. I guess, wouter has to add some error checking to his UDFs.

@wouter - just an idea: After a failure of DLLCall, do a second DllCall to GetLastError to get further info about the problem that caused FtpPutFile to fail. See MSDN - FtpPutFile

@YoseMite: At the moment there is nothing you can do, except adding the error checking in wouters code yourself, or check why the upload fails. Try to upload your file and check if that works.

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

what numbers get assignt to:

$Open

$Conn

$Ftpp

$Ftpc

like i sayd before

this is the (unfinished) result.

#cs

check'd out GetLastError and it returned no usefull info according to me.

still i altered the err handeling a bit. i will upload it into the original thread.

#ce

Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Share this post


Link to post
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
Sign in to follow this  
Followers 0