Page 1 of 1

Attachments preview

Posted: 16 Jan 2018
by luca.faro
Hi.

Is there a way to show a preview of an attachment in the form?
I need to attach a picture taken from a smartphone to elements of a list ; then I'd like to make a preview of that when you're in display mode...

Is it possible?

Thanks for your help.

Luca

Re: Attachments preview

Posted: 16 Jan 2018
by Nikita Kurguzov
Hello, Luca!
Please, check out this topic, I believe it can help you!

Re: Attachments preview

Posted: 17 Jan 2018
by luca.faro
WOW! Many thanks.
I only searched in this Area (sp 2010) and not in the other...
Just one thing...
I exactly copied everything but I dont' understand why I cannot get the hyperlink when I click the picture..(I'm not an expert ... :-))

Thanks again
Luca

Re: Attachments preview

Posted: 17 Jan 2018
by Nikita Kurguzov
Dear Luca,
The example in the other topic doesn't have hyperlinks included, but you can modify code like this and it should work:

Code: Select all

var preview = "";

$("a[href*='/Attachments/'").each(function(){
	preview += "<a href='" + $(this).attr("href") + "' target='_blank'><img class='thumbnail' src='" + $(this).attr("href") + "'></a>";
});

if (preview == "") { 
	preview = "There are no items to display."
}


$(".imgPreview").html(preview);

Re: Attachments preview

Posted: 18 Jan 2018
by luca.faro
MANY MANY MANY thanks!!!
Luca

Attachments preview

Posted: 25 Apr 2019
by benniefuT
When I preview an email body in "Email and attachments" view I do NOT see the attachment names.

When I preview the same email in "Email" view, I DO see the attachment names.

This is annoying, I want to see the email body preview to show the same thing in both views.

Re: Attachments preview

Posted: 25 Apr 2019
by Nikita Kurguzov
Dear benniefut,
Are you sure you've added Attachments field to both Content Types? Can you show us screenshots of both forms in designer and in the browser?