Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 12404
Latest: azaratir
New This Month: 10
New This Week: 0
New Today: 0
Stats
Total Posts: 39925
Total Topics: 7028
Most Online Today: 69
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 27
Total: 27

Author Topic: Ideas  (Read 684 times)

0 Members and 1 Guest are viewing this topic.

Offline shuban

  • Hero Member
  • *****
  • Posts: 653
    • 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: 14969
    • 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: 653
    • 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: 14969
    • 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: 38
  • 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: 653
    • 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: 38
  • 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: 653
    • 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
12610 Views
Last post May 20, 2007, 08:43:50 pm
by stormlrd
1 Replies
3013 Views
Last post November 14, 2007, 08:58:48 pm
by SMFHacks
6 Replies
5884 Views
Last post July 20, 2009, 05:34:34 pm
by Matth41
10 Replies
8633 Views
Last post January 28, 2012, 01:22:04 pm
by vkot
2 Replies
552 Views
Last post October 24, 2018, 10:57:39 am
by SMFHacks

+- Recent Topics

Update detect mobile mode PHP5 to PHP7 by Rock Lee
November 16, 2019, 07:18:13 pm

PHP error by davejo
November 12, 2019, 12:09:47 pm

Message Editor Pro Issues by SMFHacks
November 06, 2019, 09:58:33 pm

most popular categories doesnt work by fussilet
November 02, 2019, 02:51:42 pm

Change colors of Halloween theme by SMFHacks
October 24, 2019, 11:44:59 am

prettyurls - TroubleShooting.wiki by Rock Lee
October 10, 2019, 11:37:09 am

Some issues with adding and editing a listing by ajac63
October 07, 2019, 04:16:40 am

Problem update 1.1.21 to 2.0.15 by Rock Lee
October 06, 2019, 06:09:16 pm

[Mod]SMF 2.0.x PHP 7.2 Support by sah62
October 04, 2019, 01:46:00 pm

Ideas by shuban
October 03, 2019, 10:19:06 pm

Powered by EzPortal