Page 1 of 1

Trying to delete a file via FTP

Posted: Fri Jan 20, 2012 10:46 am
by keithglong
Hi All,

I am playing with FTP and am successfully able to upload a file to my shared server... No problem.

However, when I try the following command to delete the file after uploading, it does not work:

Code: Select all

put "file.txt" into delFile
constant FTPHOST = "ftp.mydomain.com"   
put the urlencode of "test@mydomain.com" into FTPUSER
put the urlencode of "test" into FTPPASS
get libURLftpCommand("DELE "&delFile,FTPHOST,FTPUSER,FTPPASS)
Also, when add the following line to my code:

Code: Select all

answer libURLftpCommand("HELP",ftp.mydomain.com)
I get the following error message:

421 Can't change directory to /var/ftp/ [/]

What am I missing here? Do I need to include the full path? FYI: The ftp account I am accessing is a basic account that I added via my cPanel... (It is a single directory on my server... This is not the main FTP account for my Web hosting account.)

Thanks!

- Boo

Re: Trying to delete a file via FTP

Posted: Fri Jan 20, 2012 11:21 am
by keithglong
Okay, strike that! Figured it out... The username and password should not be urlencoded:

Code: Select all

get libURLftpCommand("DELE "&delFile,"ftp.mydomain.com","test@mydomain.com","test")
Cheers!

- Boo