Jump to content
Sign in to follow this  
laudmusic

File Exists on Upload

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.

Share this post


Link to post
Share on other sites

 Base Elements has a BE_FileExist()   free plugin

Share this post


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. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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