Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4255
Latest: andreios
New This Month: 3
New This Week: 1
New Today: 0
Stats
Total Posts: 43259
Total Topics: 7518
Most Online Today: 201
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 1
Guests: 181
Total: 182

Author Topic: Ideas  (Read 3803 times)

0 Members and 1 Guest are viewing this topic.

Offline shuban

  • Hero Member
  • *****
  • Posts: 665
    • View Profile
    • Biology Forums
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: 16436
    • 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: 665
    • View Profile
    • Biology Forums
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: 16436
    • 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

  • Member
  • *
  • Posts: 39
    • 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: 665
    • View Profile
    • Biology Forums
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

  • Member
  • *
  • Posts: 39
    • 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: 665
    • View Profile
    • Biology Forums
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
14880 Views
Last post May 20, 2007, 08:43:50 pm
by stormlrd
1 Replies
4111 Views
Last post November 14, 2007, 08:58:48 pm
by SMFHacks
6 Replies
7885 Views
Last post July 20, 2009, 05:34:34 pm
by Matth41
10 Replies
12281 Views
Last post January 28, 2012, 01:22:04 pm
by vkot
2 Replies
3127 Views
Last post October 24, 2018, 10:57:39 am
by SMFHacks

+- Recent Topics

No thumbnails on new uploads by SMFHacks
March 27, 2024, 02:10:41 pm

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

an idea for new mod (( content type with different display )) by SMFHacks
February 27, 2024, 01:36:27 pm

[Mod] RSS Feed Poster by SMFHacks
February 27, 2024, 11:57:18 am

find duplicate pictures by fvlog19
February 14, 2024, 02:22:40 pm

Error uploading video. by SMFHacks
February 08, 2024, 02:04:16 pm

Gallery icon as last added image by fvlog19
February 01, 2024, 01:04:56 pm

Powered by EzPortal