DOTCMS: How to Replace a File Asset

May 8, 2023

This tutorial demonstrates two methods on how to replace a File Asset in dotCMS. (e.g. a pdf)

Video Transcript

 

welcome to this.tms training on how to
replace a file asset such as a PDF in
dot CMS
now there's a couple ways we can
approach this and I'll demonstrate two
ways first of all you want to be logged
into the dot CMS system and you'll see
right now I'm under the pages tab
I happen to know where the file like the
PDF is located so the first way I'm
going to demonstrate is knowing where
that file is
in this case I have a PDF saved under my
uploads folder and the subfolder files
this is a PDF that I currently have
saved and I want to replace it with a
new PDF
alright so what we're going to do is
first open up that PDF
and you'll see that it is a file asset
we already know that this PDF or file
asset is located in the files folder
this is the title of the PDF
and this is the file name
what I want to do is replace it without
changing anything else
adding an additional file but just
replacing that the one that already
exists so what you're going to do is go
to the bottom and you see here this
download
that's that's the file that's currently
in dot CMS you can download it to see if
it's the current one or you know the the
one that you want to replace just to
make sure but if you are certain then
all you have to do is Click remove
and what happens is you're now given the
opportunity to choose a file to replace
the one that you removed
you want to select and search for the
file
select the file that you want to use
instead
it's going to pop up a little message
asking you if you want to replace the
existing asset name with the new one and
I want to say yes
okay now I don't know if you noticed
this but the title had automatically
changed as well as the file name so the
original document just said sample
website outline
the one I'm replacing that former one
with is now called sample website
outline Dash rev1
okay so once I
select the correct file then I want to
hit save and publish
and it's as simple as that so what you
want to do is close out
of this window here and you'll now see
that in the files folder it had replaced
the original PDF with a new file name
sample website outline rev1
okay so that's one way that um that
method demonstrated how to replace a PDF
or a file asset where I already knew
where it lived in my folder
however if you don't know where you
placed it in on your website or what
folder another method is to go into the
content tab
it's the search button which will open
up your content panel
and let's say again you don't know where
it's at but you roughly know what the
name of the document a document may be
so you put in the term there I know it
was a a website outline
and
I know that it was it's a file asset
so you could scroll down and select file
asset and hit search
and it displays
um the different file assets that are in
dot CMS that I have permission to access
and just locate the the file
here in this case here's the PDF sample
website outline rev1 okay so let's say
that's the one I want to edit now I'm
going to go back I'm going to replace
this one this is the one I the new file
that I repo um
replace the old one with but now I'm
gonna go select a different file just to
show you the method again
so now you can see again the files
folder is already selected that's
telling me that's where that document
was uh was saved okay and I want to
replace this file so what I want to do
is remove the current file
again I'm going to choose this button
here now I'm going to locate the file
that I want to replace it with and here
this is the original document that I had
to replace so now I'm going to go back
to that just to show you again how it
changes
hit open
again here's a message asking you if you
want to replace it and say yes
and then again you see here the title
changed it's now samplewebsite
outline.pdf
same thing with the file name
and all you have to do
is save and publish
close out of that
and when you go into your
pages
Tab and under files because you now know
that that's where that file was put
you'll see now that the the file that
said rev-1 was replaced with the new
document
that I had selected just now
so that's how you replace a file asset
in two different methods
thank you