Upload form - not overwriting...

User 2196221 Photo


Registered User
15 posts

I have a simple form (restricted access to two users) that enables a pdf file (Porthmadog_channel.pdf) to be uploaded to the host server of the web-site I have created:- www.madocyachtclub.org.uk
Every so often the pdf file (it is a nautical navigation chart) gets updated so the purpose of the form is to upload the newer file (same name) and overwrite the existing pdf file. The file is available to download from the web-site.
However, I have found that during upload the existing file is not overwritten, but a new file with a few random letters added to the file (for example Porthmadog_channel_lhms6v.pdf) is uploaded instead ie. the existing old file and the new file with slightly different names are now on the server.

Any ideas please on how to get the newer file to overwrite the existing file on the server, or is caused by the server? R/w permissions of the file on the server are set as allowed.
User 103173 Photo


VP of Software Development
0 posts

What is probably going on is your "storage" folder is owned by the web user and not the FTP user. I would suggest uploading everything but the "storage" folder and that should fix you up.
Learn the essentials with these quick tips for Responsive Site Designer, Responsive Email Designer, Foundation Framer, and the new Bootstrap Builder. You'll be making awesome, code-free responsive websites and newsletters like a boss.
User 2196221 Photo


Registered User
15 posts

Thanks for the suggestion.
I deleted all files and ftp'd all files apart from 'files' directory in 'storage'.
Uploaded pdf via the form - a new directory 'files' was formed and the pdf in it.
However, when trying to upload the pdf again it was renamed, so unfortunately this did not cure the problem.
User 2196221 Photo


Registered User
15 posts

I've managed to sort out the problem of uploading a new file by using a separate php script to 'unlink' the old file.
So, the old file is effectively deleted before the new file is uploaded.
At the moment this is carried out additionally to the upload form - is there any way to include the 'unlink' script in one of the files that are published by the Form Builder (version 2)?
If so, which file should I add the script to?

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.