#1 WordPress forum plugin created by gVectors Team

wpForo – WordPress Forum Plugin
  • Home
  • Forum
  • Migrate to wpForo
  • Addons
  • Addons Demo
  • Documentation

Forum

Home | Forum

wpDiscuz - WordPress Comment Plugin
  • Forums
  • Members
  • Recent Posts
Forums
Main Support Forums
How-to and Troubles...
Downloading custom ...
 
Share:
Share
Tweet
Share
Notifications
Clear all

Script Downloading custom file types from wpForo forum attachment

    Last Post
RSS

LuminaCommunityEngagement
Posts: 1
 LuminaCommunityEngagement
Topic starter
July 23, 2021 9:55 pm
(@luminacommunityengagement)
New Member
Joined: 10 months ago

Hi there! I am setting up a forum for our website, and our users need to be able to upload a custom file type called an Analytica model (.ana).  Since .ana is a custom file type, I installed the WP plugin "File Upload Types" and added .ana files to the list of approved uploads. So the Analytica models (.ana) files can be uploaded to the forum, however when someone viewing the post then clicks on the uploaded model, it opens in a separate browser as a text file. 

My question is: how do I allow a user to download custom file types instead of having it open as a text file in a browser?  I realize this is partly a wpForo question, partly a File Upload Type question, but any help would be much appreciated! Alternatively, if someone could click on the attachment and have it automatically launch our Analytica program, that would be even better! Until our users can upload and download these Analytica models (.ana file types), our forum is somewhat useless!  

Note: In "File Upload Types" plugin, you are supposed to assign a custom MIME type, and using a File Type Checker website, it tells me that the MIME type is plain/html.  However this does not seem correct, because the .ana files are launched in the Analytica software/application.  

Thanks!
KM

This topic was modified 10 months ago by LuminaCommunityEngagement
Topic Tags
custom file types attachments MIME type download attachment
1 Reply
Robert
Posts: 8969
Robert - Twitter
 Robert
Admin
July 24, 2021 7:11 am
(@robert)
Support Team
Joined: 6 years ago
Posted by: @luminacommunityengagement

Note: In "File Upload Types" plugin, you are supposed to assign a custom MIME type, and using a File Type Checker website, it tells me that the MIME type is plain/html.  However this does not seem correct, because the .ana files are launched in the Analytica software/application.  

I think the problem comes for registering the custom file type. How have you registered it and what MIME type have you set for .ana file format?

 

Posted by: @luminacommunityengagement

My question is: how do I allow a user to download custom file types instead of having it open as a text file in a browser?

Put this hook code in the functions.php file of your current active theme or use Code Snippets plugin for inserting custom hook code:

function wpforo_force_download_ana_files($text){
if( strpos($text, 'wpforo-default-attachment') !== FALSE && strpos($text, '.ana') !== FALSE ){
$text = preg_replace('|(class=\"wpforo-default-attachment\"[^><]+href=\"[^\]\[]+\.ana\")|s', '$1 download ', $text);
}
return $text;
}
add_filter('wpforo_content_after', 'wpforo_force_download_ana_files', 10);

In case you want to say thank you !)
We'd really appreciate and be thankful if you leave a good review on plugin page. This is the best way to say thank you to this project and support team.

Reply
  All forum topics
  Previous Topic
Next Topic  
Related Topics
  • how to add image in the post?
    7 days ago
  • Attachments feature
    2 weeks ago
  • How can I download and insert images into posts?
    1 month ago
  • Images warped when selecting
    10 months ago
  • Attachment Permalinks Don't Work for Certain Attachment Type
    1 year ago
Topic Tags:  custom file types (1), attachments (19), MIME type (1), download attachment,

Forum Search

Join Us!

Download wpForo plugin
on WordPress.org

wpForo Addons

wpforo-private-messages wpforo-advanced-attachments-128x128 wpforo-embeds-128x128 wpForo User Custom Fields addon wpForo – Blog Cross Posting addon wpForo Ads Manager wpForo – WooCommerce Memberships Integration wpForo Emoticons wpForo – Tenor GIFs Integration
View all Addons »

Recent Topics

  • No Wpforo widget

    By Vijiki, 7 hours ago

  • Guest to not see recent posts on Recent activity page

    By OMTesla, 17 hours ago

  • Prevent access to the url "community"

    By totor, 2 days ago

  • Dark mode

    By Vijiki, 2 days ago

  • Menu location

    By Vijiki, 2 days ago

  • Setting recent topics on forum frontend

    By Vijiki, 3 days ago

Topic Tags

  • translation49
  • css49
  • plugin conflict48
  • seo45
  • new features44
  • buddypress42
  • ultimate member40
  • avatar40
  • forum40
  • moderation38
  • login38
  • registration36
  • threaded layout35
  • cache33
  • editor32
  • menu32
  • shortcode31
  • spam29
  • forum accesses29
  • phrases28
View all tags (2163)

Recent Posts

  • No Wpforo widget

    Of recent I can't seams to find my wpforo widgets. Wh...

    By Vijiki, 7 hours ago

  • RE: New wpForo

    Hi @gsmdahisi, I'm sorry, but the reputation badges wi...

    By Robert, 9 hours ago

  • RE: Prevent access to the url "community"

    @chris Ok... I'll have to buy new glasses! Thanks ...

    By totor, 15 hours ago

  • RE: Guest to not see recent posts on Recent activity page

    Hello Sorry to ask here. What causes as a guest to ...

    By OMTesla, 17 hours ago

  • RE: Dark mode

    @vijiki, try this: .wpforo-widget-content .wpforo-...

    By Chris, 19 hours ago

  • RE: How to make logo appear on the BP photo

    Just like here, the wpDiscuz Image shown above the menu...

    By Chris, 2 days ago

  • RE: Draft draft users post on wpforo

    @vijiki, You can set the post/topic unapproved, so th...

    By Chris, 2 days ago

Share:
Share
Tweet
Share
  Forum Statistics
20 Forums
9,767 Topics
49.5 K Posts
8 Online
44.3 K Members

Latest Post: No Wpforo widget Our newest member: angelesizzo6728 Recent Posts Unread Posts Tags

Forum Icons: Forum contains no unread posts Forum contains unread posts

Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Powered by wpForo | Copyright © 2016-2022 gVectors Team
Copyright Registration Service - Click here for more information or to register work
wpForo is Registered with the IP Rights Office
Copyright Registration Service

Ref: 4477265538
  • Home
  • Forum
  • Migrate to wpForo
  • Addons
  • Addons Demo
  • Documentation