FTP a file???

Posted on 2005-05-04
Last Modified: 2013-11-13
I want a simple way to upload a file to a ftp server. It has to overwrite the file if it's already on the server. So i'm guessing it should be done with Winsock, instead of Inet, unless Inet can overwrite files.

Here's what i had but this doesn't overwrite files,

Inet1.AccessType = icUseDefault
Inet1.Protocol = icFTP
Inet1.RemoteHost = ""
Inet1.RemotePort = "21"
Inet1.Password = "pass"
Inet1.UserName = "user"
Inet1.RequestTimeout = "60"

strLocal = file.Text

strRemote = "/usr/home/public_html/upload/" & upfilestr
Inet1.Execute , "PUT """ & strLocal & """ " & strRemote


Question by:jmingo
    LVL 26

    Expert Comment

    Inet1.Execute , "DELETE " & strRemote

    Author Comment

    so always delete the file every time??

    won't that cause an error if the file isn't there?? would i just put error handling to ignore it if the file isn't there??? if so do you know what the error number for that is??


    LVL 26

    Accepted Solution

    so always delete the file every time??

    yes don't think you can get any error.
    To be save do on error resume next
    LVL 7

    Expert Comment

    If I remember correctly, the Execute method just sends the data to the server. You have to interpret it yourself. So, if it returns an error caused by the "DELETE" being sent for a file that doesn't actually exist, and don't interpret the server's response as "bad", then there's no problem (If I remember correctly).

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Suggested Solutions

    Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
    The purpose of this article is to demonstrate how we can use conditional statements using Python.
    The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now