File Upload Icons

QuestionsFile Upload Icons
Gary Brett asked 9 years ago

Hi Abu, on your demo file_upload.php if I upload an image it displays in note field no problem. If however I upload PDF, DOC or xls for example it shows a broken image icon, is there a way for it to display the icons of these file types please?

4 Answers
Abu Ghufran answered 9 years ago

Here you will need on_data_display calback function, which will check the file extension and display custom image.
e.g. with image display column:

$col["on_data_display"] = array("display_icon","");

function display_icon($data)
{
$kw = $data["image_field"];
// if $kw ext is doc
// return "doc.jpg";
// else
// return $kw;
}

Gary Brett answered 9 years ago

Thanks Abu, is this in the demo file so I can investigate full code, it wont load on your sites demo, says email you?

Thanks

Abu Ghufran answered 9 years ago

Code here:
http://pastebin.com/ViH3nvxD

Refer line 112-134

Gary Brett answered 9 years ago

Brilliant Abu, much appreciated works very well to display, pdf, doc, xls and any other files.

Gary

Your Answer

6 + 19 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?