Home › Forums › Classic DFFS › Default "Overwrite existing files" in Upload Image unchecked
- This topic has 4 replies, 3 voices, and was last updated 9 years, 1 month ago by Alexander Bautz.
-
AuthorPosts
-
-
October 30, 2015 at 15:34 #9124
Hey everyone,
I’ve tried a few different things to no avail on this. When you insert an image into a rich text field in a list item, and you choose “From Computer”, you get an upload image dialog.
The issue I’m having is that I can’t seem to make it default to unchecked using any jQuery, and can’t get it to be hidden with any CSS. We use this list for a knowledgebase so preventing users from accidentally replacing images is something we’d like.
Yet even when I have the ID of the input in my Custom CSS field set to display:none it still shows.
Any ideas?
Thanks!
- This topic was modified 9 years, 1 month ago by Bloodlvst.
-
November 2, 2015 at 20:10 #9150
Hi Kyle
Can you use a slightly different approach and make use of DFFS to achieve the same end result and avoid jQuery altogether? I’ve used something similar for a wiki and wanted to control what users did with images (no overwrites or editing – effectively provides version control of the images within pages)
The upload.aspx form generally isn’t controlled by DFFS…so custom css set ‘there’ won’t have any effect.So…
First – You can modify permissions on the library where you’re storing the images so that people can add but not modify items (you may need to create and edit permission levels to achieve this). We have a permission level called “contribute-add only”. I’ve not double checked but I believe that would prevent an overwrite of files with exactly the same name.
Second – Use dffs rules on the image library editform.aspx to create a specific and unique filename – eg append the date and their username onto the filename on save. That effectively creates a completely unique file reference that can never be overwritten.Does that make sense? Does anyone else have any improved methods?
I’ve had issues with inserting images into rich text fields on lists though – the image file seems to get stored in a folder called either newform or editform…not very user friendly.
Adam
-
November 4, 2015 at 18:53 #9181
Hi,
Sorry for the delay. I must agree with Adam that adding images to rich text fields are messy when you look at how the images are stored in the location you save them (site assets by default).I do however have a solution to your requirement. It’s not that pretty as it uses a setInterval function to look for the upload dialog, but it should work.
Put this in the custom js textarea in the DFFS form:
setInterval(function(){ var uDlg = $(parent.document).find("iframe[src*='/Upload.aspx']"); if(uDlg.length > 0){ $(uDlg[0]).contents().find("input:checkbox").prop("checked",false).parent().hide(); } },1000);
Alexander
-
November 4, 2015 at 20:08 #9189
Thanks to you both!
Alex, your solution works great after testing it out.
A small question though, instead of calling the function over and over using setInterval(), would you recommend adding a clearInterval() once the change is applied to the Upload.aspx? Or is the impact on performance negligible?
Thanks again, happy camper here 🙂
-
November 10, 2015 at 08:03 #9237
Hi,
No, I would not do this as an additional call to the insert image will then not have this “fix” applied.Of course it would be better to trigger this on click, but I don’t think the current approach will pose any problems as the “query” for the iframe will not be so heavy.
Alexander
-
-
AuthorPosts
- You must be logged in to reply to this topic.