Search

Hi,

So this is my second post of the day, and I am sure you can tell by that (and the basic-level questions I am asking) that I am still a beginner.

I made a file upload field on my site and when I upload a file by the same name in another post it doesn't let me, saying the "file by that name already exists." What I want to know is if there is a way for it not to ask me and for it to just overwrite the existing file, or is that complex/advanced?

Thanks, Aram

I imagine this would be a good suggestion for an addition to the File Upload field in the future. It could be a configurable checkbox when adding the field to a Section.

In the meantime, you might want to check out Rowan's Hashed Upload Field. The uploaded file will be renamed using a hash of the original file and the current date/time, so ensuring a unique file name. It guarantees files aren't overwritten (and therefore allows you to upload two files with the same name but use them for two different entries), with the downside that the file names become meaningless.

I tend to use the Hashed Upload Field as a replacement for the Upload Field on all of my sites! Perhaps that's enough indication that the File Upload field should have an "allow overwrites" option?

Very cool... sorry, should have looked harder to find this before posting. Much appreciated!

though I haven't used the Hashed Upload Field, I have used the Unique Upload Field. Like the hash field, this won't overwrite existing files, it will just append the current UNIX date to the file name, so it's pretty hard to get a duplicate (if ever).

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details