vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Attachment help (https://vborg.vbsupport.ru/showthread.php?t=270531)

da_judge 09-18-2011 10:41 PM

Attachment help
 
Im workin on something to do with downloads... Im having trouble with it grabbing attachments..

Im using file system not db... this is the code im using... all files are 0 bytes

Code:

//Getting attachment
if ($vbulletin->input->clean_gpc('g','id',TYPE_UNIT))
{
//attachment id
$id=intval($vbulletin->GPC['id']);
//select the content from the table
$get_zip=$db->query_read("SELECT *FROM ".TABLE_PREFIX."attachment where attachmentid=$id");
// print the file
while($_zip=$db->fetch_array($get_zip))
{

Any ideas where im going wrong

Cheers

kh99 09-19-2011 07:05 PM

I'm not sure what you're trying to do. The code you have there gets an attachment record from the database but I don't see where you're trying to get the actual file data. You could look at attachment.php. In fact you may be able to use attachment.php to get the data for you instead of figuring out the details.

da_judge 09-25-2011 08:09 PM

Thanks for reply...

Im after grabbing file... but not from database... as all my files stored in filesystem ;)

Cheers

kh99 09-25-2011 09:16 PM

Right, I see where you said you're getting them from the file system, and you said they are 0 bytes, but you don't seem to have shown the code where you get the file name or try to read the file. The code you posted just looks like it reads a record from the db, so I don't how we can help you from that (but maybe someone else will, I don't know). I also don't understand if you still need help :)

souperman 09-27-2011 11:11 PM

You would need to know how vb creates its directory structure. Since they don't want all your attachments in one directory, the attachments are split in multiple dirs. Once you find out the structure, etc. you can just pull the attachment ID and include it in a php file with the proper headers. You can't view the attachments directly, if that's what you're wondering.

da_judge 09-28-2011 05:47 PM

Basically its a multi download script...

It was working when i stroered files in database

Now i store in file system... i get 0 bytes :(


All times are GMT. The time now is 11:22 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00966 seconds
  • Memory Usage 1,716KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete