Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-29-2015, 09:44 PM
sa3eka sa3eka is offline
 
Join Date: May 2008
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default ask about method for saving attachment on server

Hi everyone

I want Ask About method for saving attachments(files) on server ?
I try learn the method .
make folder for every member in Attachments folder and named by number id for member and save file uploaded by member in his foder e.x.
admin have id 1
then will be folder for his files ( attachments/1/ )
the admin upload image ( vb.png)
will saved in his file by id in attachment in data base
the directory will be
(vb/attachments/1/287.attach)



that's correct ??

thanks
Reply With Quote
  #2  
Old 11-30-2015, 01:27 AM
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Location: DFW, Texas
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Basically, but user 111 will have a folder of vb/attachments/1/1/1/123.attach
Reply With Quote
Благодарность от:
sa3eka
  #3  
Old 12-02-2015, 12:54 PM
sa3eka sa3eka is offline
 
Join Date: May 2008
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok bro
But i want programming file(php) make me can get contact the attachment via id user and id attachment ....

how i can get it? if i have 300.000 user in my form
Reply With Quote
  #4  
Old 12-02-2015, 02:34 PM
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Location: DFW, Texas
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

to make sure I am understanding, you want a script which will view an attachment file, in the file system, and return the contact info of the user who posted it?
Reply With Quote
  #5  
Old 12-02-2015, 09:58 PM
sa3eka sa3eka is offline
 
Join Date: May 2008
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yah like
if i have member id is =1 and id for attachment in database is =25

http://site.com/show_attach.php?user=1&attach=25
and sorry for my English language
Reply With Quote
  #6  
Old 12-02-2015, 11:49 PM
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Location: DFW, Texas
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well, the folder structure will always be 1 digit. So you know user #111's attachments will be in folder attachments/1/1/1/files. user #112 will be in attachments/1/1/2/files. user 345 will be in attachments/3/4/5/files etc

user #3000 = attachments/3/0/0/0/files
user #30000 = attachments/3/0/0/0/0/files

you can see that the folders stack.

Try something like this (stolen from Stack Exchange):
PHP Code:
puteveryXcharacters($userid,"/",1);

function 
puteveryXcharacters($str,$wha,$cnt) {
  
$strip false;
  if (
strlen($str) % $cnt == 0) {
    
$strip true;
  }
  
$tmp preg_replace('/(.{'.$cnt.'})/',"$1$wha"$str);
  if (
$strip) {
    
$tmp substr($tmp,0,-1);
  }
  return 
$tmp;

if userid is 123 this should return 1/2/3

NOTE: This has not been tested by me, so use with caution.
Reply With Quote
  #7  
Old 12-03-2015, 06:57 PM
sa3eka sa3eka is offline
 
Join Date: May 2008
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thank u bro,
I test it,
that work for me
thanx
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:34 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03747 seconds
  • Memory Usage 2,228KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (1)post_thanks_box_bit
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete