miniBB Support Forums | 15 years on The Web
miniBB ®

miniBB

®
  
 | Begin | Register | Reply | Search | Statistics | Manual |
Specific miniBB Support Forums / Specific /   
 

File upload to different folders

 
Author Rider
Partaker
#1 | Posted: 16 Oct 2017 23:48 
I am thinking about getting the file upload addon. I want to create 5 topics, each of which is about one product, so topic 1 is about product A, topic 2 is about product B, etc. In topic 1 people can upload images about product A, in topic 2 images about product B, etc.

The uploaded images will be shown on our website in some html table view through a php script which I will (try to) build. There will be 5 slideshows, each one is about 1 product. So I need a way to identify the images as being product A, B, C, D or E, either by the folder they are stored in, either by their file names. I suppose I will need to modify the addon-script for that, because this will default not be possible, will it?

(btw. if better I can create 5 (sub)forums instead of 5 topics)

Author Paul
Lead Developer
#2 | Posted: 17 Oct 2017 11:31 | Edited by: Paul 
Rider:
I suppose I will need to modify the addon-script for that, because this will default not be possible, will it?

I doubt you need to modify the add-on itself. Its data storage principle is very simple and straight: each file is stored under the special folder named by topic ID. Knowing a certain topic ID, you could refer to this folder and read all files from it by a simple PHP function. You only need to filter these files in your script, and for the slideshow script, take either thumbnails either fullsize pictures (which could be recognized by their file mask).

Whatever is important, is that you need a heavy moderation on these topics, so users upload only related pictures and nothing else disallowed.

Author Rider
Partaker
#3 | Posted: 17 Oct 2017 12:58 
That's awesome! I didn't realize the topic id is in the folder name. That will make it very easy for me to identify the correct images. Thank you, you're the best.

Author Paul
Lead Developer
#4 | Posted: 17 Oct 2017 14:01 
Rider:
I didn't realize the topic id is in the folder name.

This is actually default, but it's also optional. This add-on also could be configured that all files are stored in just one folder. In some ancient times, some hosters were enabling so called PHP Safe Mode which doesn't allow for a PHP script to create new folders on the fly. That's why only one folder was used.

However I don't recommend to enable this feature - because sometimes, you could exceed "inodes" i.e. files amount limit under one folder. It's still better (and smarter) to enable the default mode when files are split by topic-ID named folders.

Cheers.

Author Rider
Partaker
#5 | Posted: 21 Oct 2017 22:12 | Edited by: Rider 
Hi,

I installed the file upload addon. It works like a charm! Very nice. Also the image gallery I created outside of the forum, which makes use of the uploaded images in the forum, works fine: each image in the gallery contains a href hyperlink which takes the visitor right to the correct forum, topic and message in which the image was uploaded. I was able to create the hyperlinks by making use of the foldername and filename of the uploaded images, like we discussed earlier in this thread.

But.... tonight we walked into a problem. If the message with the uploaded image in it is not on the first page of the topic, but on the second (or higher) page, I can't create a proper hyperlink anymore because I don't know the page number the message is in. So from the image gallery I can't link to messages if they are on page 2 or higher. The links I created are like blabla/forum/index.php?action=vthread&forum=11&topic=15729#msg112990

Do you think there is a hyperlink possible that takes the visitor to the correct message even if on page 2 or higher without knowing the pagenumber?

Author Paul
Lead Developer
#6 | Posted: 21 Oct 2017 23:32 
Get and install the Advanced Anchors add-on. Referring to msg.php script, you will always point to the proper page where a certain message is on.

Author Rider
Partaker
#7 | Posted: 21 Oct 2017 23:36 
Great, I'll read into that. Thanks for your quick help!

Author Rider
Partaker
#8 | Posted: 22 Oct 2017 15:48 
The addon works great. It solved my problem. Thanks again.

Author Paul
Lead Developer
#9 | Posted: 22 Oct 2017 16:26 
Rider
You're welcome, and thanks for letting us know :)

Specific miniBB Support Forums / Specific /
 File upload to different folders
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


 ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Get the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
↑ TOP