Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question re: how to copy file to ftp directory
#1
Still going at it -- addictive stuff, QM.

I promise I'll get some sleep after this one...

In the same "module" as my post "Please Help: elected file" etc., after copying (and renaming at the same time) the file to local upload directory, I need to upload that same file to an FTP directory.

I tried to use the FTPUpload function (by force-specifying a local file, and changing the arguments to my proper FTP url, username, password. The process runs, returns no errors, says "FTP session has ended", yet no file has been copied to the FTP site directory. I tried commenting out the pw encryption declaration and changed the "pw" to "mypassword" I tried different "ftpdir"s and all manner of formatting the ftpdir variable.

In order to get beyond this spot, I used NetDrive to assign the ftp site to drive X like such:

Code:
Copy      Help
cop "C:\test.txt" "X:\web\nxxxx.org\mediafiles\test2.txt"

NetDrive works fine for now, tho I'd rather have it built in and not relying on having NetDrive istalled.

I also tried using the cop function with the standard "ftp://username:password@ftp.server.com/ftpdir/" format (which worked perfectly well in IE, 2xplorer etc. address bar).

ISSUE: copy local file zz (string/variable) to remote ftp server (I don't need to browse for files at all, just copy from str zz to the FTP directory. Can I do this within the macro code?

Here's the preceeding code before file can be uploaded, all working fine...

Code:
Copy      Help
zz.from("C:\murFTP\upload\" t "_" u m)
,,
str s
,if(BrowseForFolder(s "c:\murFTP\" 1 "Select File"))
,,
,,if mes("You Are about to rename and copy file to upload directory." "Proceed?" "OC1t")='O'
,,,cop s zz


Any help is surely appreciated...thanks again!

Steve
#2
I often use FtpUpload to upload my files. It works well. In your case, maybe it depends on FTP site, or some parameters are incorrect. Try to use Ftp class functions directly, without FtpUpload. Password can be encrypted ("[*...*]") or not. Example:

Code:
Copy      Help
;Declare variable and start FTP session:
Ftp f.Connect("ftp.server.com" "myname" "[*074A294684CB7360*]")

;Change current ftp directory:
if(!f.DirSet("public_html/images")) mes- "FTP error: DirSet failed."

;Change current local directory:
ChDir "c:\my documents\my pictures"

;Upload file:
if(!f.FilePut("one.gif" "one.gif")) mes- "FTP error: 'one.gif' upload failed."
#3
Using the FTP class functions directly works great. Thanks so much!
Cheers,
SMurphy


(I think it was a firewall problem on this end - zonealarm was not reporting a access request (allow/deny), but when I disabled zonealarm the Windows firewall automatically turned on and asked if I want to allow access...However, I still can't get the FTPuploader to work for me, so your direct class tips saved the day and I can move on...).


Forum Jump:


Users browsing this thread: 1 Guest(s)