Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 12376
Latest: Printablecalendars
New This Month: 3
New This Week: 2
New Today: 1
Stats
Total Posts: 40218
Total Topics: 7083
Most Online Today: 57
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 38
Total: 38

Author Topic: Ideas  (Read 1207 times)

0 Members and 1 Guest are viewing this topic.

Offline shuban

  • Hero Member
  • *****
  • Posts: 657
    • View Profile
    • Homework Clinic - Your Academic Lifeline
Ideas
« on: September 30, 2019, 10:06:42 pm »
I know that when a document is uploaded, such as .doc, the mod stores the file without the file extension. I am looking to implement a document reader, such as google docs to display the file as a preview. It is done by using an iframe:

Code: [Select]
<iframe src="https://docs.google.com/gview?url=https://WEBSITE-URL.com/to/doc/file.doc&embedded=true"></iframe>
So for this to work, I need to use: https://WEBSITE-URL.com/downloads/'.$context['downloads_file']['filename'].' BUT, $context['downloads_file']['filename'] excludes the file's actual extension type. Even if I add the extension, such as .doc to the end of the string, it will not work because obviously the file stored is extension-less.

What ideas do you have that can help me overcome this issue? Of course, I could always create a temporary file in another folder with the extension, but when files get too big, it'd slow down the server.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15109
    • View Profile
Re: Ideas
« Reply #1 on: September 30, 2019, 10:17:28 pm »
I guess you could do a another script that outputs the contents of a download file if you pass the id. Files are stored with extension for security reasons same reason that SMF stores attachmetns that way.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline shuban

  • Hero Member
  • *****
  • Posts: 657
    • View Profile
    • Homework Clinic - Your Academic Lifeline
Re: Ideas
« Reply #2 on: September 30, 2019, 10:23:36 pm »
such as the download link itself, right? I believe I tried that, but no dice. Unless you had another idea in mind.

I like that it's extension-less actually, it's a good deterrent from folder hackers

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15109
    • View Profile
Re: Ideas
« Reply #3 on: September 30, 2019, 10:25:18 pm »
Like a file that gets the ID of file from smf_file table.  Then does db lookup finds the filename.

Then does an echo of file_get_contents to display the file or something similar.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline Diego Andrés

  • Newbie
  • *
  • Posts: 39
  • SMF lover
    • View Profile
    • SMF Tricks
Re: Ideas
« Reply #4 on: October 03, 2019, 09:29:22 pm »
If you are putting these docs in a lone category you could also only set up this reader for that particular cat ID so you don't have to find the extension, you already know it's a doc

SMF Tricks - Free & Premium Themes for SMF.

Offline shuban

  • Hero Member
  • *****
  • Posts: 657
    • View Profile
    • Homework Clinic - Your Academic Lifeline
Re: Ideas
« Reply #5 on: October 03, 2019, 09:31:13 pm »
I'm not following. The files are stored without extensions.

Offline Diego Andrés

  • Newbie
  • *
  • Posts: 39
  • SMF lover
    • View Profile
    • SMF Tricks
Re: Ideas
« Reply #6 on: October 03, 2019, 09:54:25 pm »
I'm quite sure that if you add the original extension it'd work as a normal file.

SMF Tricks - Free & Premium Themes for SMF.

Offline shuban

  • Hero Member
  • *****
  • Posts: 657
    • View Profile
    • Homework Clinic - Your Academic Lifeline
Re: Ideas
« Reply #7 on: October 03, 2019, 10:19:06 pm »
I'm quite sure that if you add the original extension it'd work as a normal file.

Tried that. Didn't work

 

Related Topics

  Subject / Started by Replies Last post
13 Replies
12846 Views
Last post May 20, 2007, 08:43:50 pm
by stormlrd
1 Replies
3106 Views
Last post November 14, 2007, 08:58:48 pm
by SMFHacks
6 Replies
6046 Views
Last post July 20, 2009, 05:34:34 pm
by Matth41
10 Replies
8884 Views
Last post January 28, 2012, 01:22:04 pm
by vkot
2 Replies
717 Views
Last post October 24, 2018, 10:57:39 am
by SMFHacks

+- Recent Topics

Download System Lite by Rock Lee
June 03, 2020, 07:34:24 pm

Font question by SMFHacks
May 27, 2020, 08:15:26 am

Error message with latest SMF 2.1 Github build by Hatshepsut
May 25, 2020, 01:43:26 am

smfblog not working on 2.0.17 by tech9
May 20, 2020, 01:44:34 pm

Copyright removal by stbc
May 18, 2020, 01:27:57 am

Mod Verified User i can't square the image by Rock Lee
May 07, 2020, 07:56:10 pm

SMF4Mobile 2.0 released for SMF 2.0.x by SMFHacks
May 06, 2020, 12:13:14 pm

SMF Social Login Pro - Discontinued? by Nicole
May 02, 2020, 05:47:04 pm

Likes by SMFHacks
April 30, 2020, 09:50:35 pm

Upgrade Issue - by SMFHacks
April 28, 2020, 12:40:13 pm

Powered by EzPortal