cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Community Member

How to update a file without breaking links to it.

Jump to solution

If I have a file that is linked to in several different areas of my Canvas shell, how do I update that file without breaking all those links?

Tags (2)
1 Solution

Accepted Solutions
Highlighted

Hi Earl! And Hi mbialecki@occ.cccd.edu‌!

My experience has been the opposite: I think you can safely update a file by uploading a new version, and the links will not break. I do that a lot, actually, because I upload files that are javascript calls, and the iframes where I include the file work fine. You will be prompted when you upload a file with the same name whether you want to update the contents or not:

The place where I have run into trouble is if I change the name of a page. Because the URL of a page actually contains the name in the URL, that means the links break if you change the name (title) of the page.

View solution in original post

9 Replies
Highlighted
Community Member

Hi Michael,

See Laura's reply below!  She's got the answer!    ;>)

Highlighted

Hi Earl! And Hi mbialecki@occ.cccd.edu‌!

My experience has been the opposite: I think you can safely update a file by uploading a new version, and the links will not break. I do that a lot, actually, because I upload files that are javascript calls, and the iframes where I include the file work fine. You will be prompted when you upload a file with the same name whether you want to update the contents or not:

The place where I have run into trouble is if I change the name of a page. Because the URL of a page actually contains the name in the URL, that means the links break if you change the name (title) of the page.

View solution in original post

Highlighted

Here's a screenshot of the prompt: I can successfully replace the file with a new version, and old links still work fine.

upload file link

Highlighted

Awesome Laura! I absolutely love it when I am proven wrong, especially when it can save serious time!!!

Thank you for this revelation!    ;>)

0 Kudos
Highlighted

I sure do wish we could change Page titles as nicely we can upload new versions of files! 🙂

Highlighted
Community Member

I thought the information in this thread was true, but today I found that a file I "replaced" in the file structure, didn't display on the Page link. The Page held onto the prior version even after clearing browsing history, closing the browser, and trying it again. I tried Firefox and Chrome just in case it was the browser, but the issue persisted.

I called Canvas support and was told "Replacing" a file in the file structure, with the popup forcing the Replace choice to be made, DOES NOT update the links to the content throughout your course. Canvas help denies the information in this thread is correct.

Below is my example - the different is the name on the document where the left side is the original version linked on the Page and the right side is the new version with the exact same name in the Files.

Does anyone have any information that could explain the discrepancy in how people think the system works vs how it actually works - it makes no sense that Replace wouldn't actually replace and significantly effects workload.

315789_File Replace Breaks Links.png

0 Kudos
Highlighted

How are you linking the file within Canvas? What does the link look like in the HTML editor?

How are you replacing the file? Just having the same name isn't sufficient as you can upload (for example) readme.docx into three different folders. You have to replace the actual file.

The one on the left appears to be called "Session Handout" while the one on the right looks to be "BEFORE_CerebrovascularDisease.pdf".

A long time ago, Canvas replaced the file and deleted the old one. It kept the same file ID. Then they changed it so that replacing a file marks the old one as deleted but keeps it and then creates a new file ID for the new file. That old file is linked to the new file ID so that it gets the new version when you refer to the old file.

Canvas Support is absolutely correct when they say that links are not updated. Laura is also correct when she says that she doesn't have to change the link when she replaces the file.

Edit: Actually the links do change on a page -- at least in some circumstances.

Unless things have recently changed, then it's most likely in the way that you've created the link or the way that you replaced the file, which is why I'm seeking additional information there.

Highlighted

The "Session Handout" is text that was highlighted in the html editor and linked to a file in the structure called "BEFORE_CerebrovascularDisease.pdf" by selecting it from the options to the right (see images below). So if you hover over the actual link on the course it shows the correct file name as the link.

I kept testing after I posted (not wanting to take the answer at face value) and of 4 items handled the exact same way, 3 worked just fine and show the updated info correctly.

315800_Link.png

315790_Adding a link to a file.png

0 Kudos
Highlighted

villanuevam1@uthscsa.edu,

I did some more testing. I created a page that contains a link to a file three different ways.From the content selector of the rich content editor, by going to files and right clicking on the file, and copying the link, and by previewing the file and copying the URL from the browser. I duplicated each of this with link text and without link text, although that turned out to not matter.

315841_pastedImage_1.png

With the original file, all of those worked.

When I replaced the original file, it changed from file ID 124055711 to 148308533. The first 4 links worked, the last 2 did not. The last 2 gave a file not found error.

The HTML editor reveals that the first one looks like this (I made the links relative URLs just to save space):

<a 
class="instructure_file_link instructure_scribd_file"
title="The Table.pdf"
href="/courses/896851/files/124055711/download?wrap=1"
data-api-endpoint="/api/v1/courses/896851/files/124055711"
data-api-returntype="File">

The Table.pdf
</a>

When I replaced the file, edited the page, and looked at the HTML, I now have this:

<a 
class="instructure_file_link instructure_scribd_file"
title="The Table.pdf"
href="/courses/896851/files/148308533/download?wrap=1"
data-api-endpoint="/api/v1/courses/896851/files/148308533"
data-api-returntype="File">

The Table.pdf
</a>

The 5th attempt kept the original HTML, which looks like:

<a 
href="/courses/896851/files/folder/Handouts?preview=124055711">

https://richland.test.instructure.com/courses/896851/files/folder/Handouts?preview=124055711
</a>

I then went in and removed the data-api-endpoint from the first one, the data-api-returntype from the second, and both of those from the third.

I replaced the file again and now it has ID 148308534. When I edited the page and looked at the HTML, it had updated the ID to the new one, so those data-api-* values don't change things. It looks for the URL in the link.

Now all of this is specific to a page. Was there something special about the one case it didn't work? Was it in an assignment or syllabus page as opposed to a content page? I didn't check assignments, but the syllabus page changed the ID when I replaced the file.

One thing I would check is that the course ID is correct on the one that doesn't work. Sometimes people copy/paste content from another course and forget to change the course ID on links. Because you have access to that course, you can see the file, but it won't update because it's a link to a different course. Students would not be able to see that file, though.

Top Kudoed Authors
Labels