Jump to content

File Exists on Upload


This topic is 2047 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Is there a function that will return an error or 1 if the file I want to upload if it already exists?

 

The idea is that if the file exists, I do not want to overwrite it, I want to capture the error or result then give the user the option to rename the file that is going to be uploaded.

Link to post
Share on other sites

I believe I responded to OP via support ticket today but for the sake of information...

There is not a function in FTPeek that explicitly checks to see if a file exists on the FTP server. However, I believe that you can accomplish this through scripting. You can use the function FTPeek_GetFileList and then iterate through that list checking against the name of the file you are going to upload. If it exists, you can use FTPeek_Rename to rename the remote file or you can rename the file on the local machine. Another way to check would be to try and download a file named the same as the file you are trying to upload. If you don't return a 1 then the file does not exist. Make sure you use this function correctly because you can get other errors that would not result in 1. Also, another downside to this method is that you will download the file if it does exist. I have not tested these methods fully but I believe that they will work. I'm sure that there are other workarounds but there are no explicit and direct way to check for file existence using FTPeek. 

Link to post
Share on other sites

This topic is 2047 days old. Please don't post here. Open a new topic instead.

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

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.