vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Attachments as files (https://vborg.vbsupport.ru/showthread.php?t=35193)

jjj0923 04-26-2003 07:43 AM

I installed this hack on 2.2.9 AND have the hack that allows people to add attachments on editpost an ran into a small problem.

with a combination of this code from this hack and also the add attachment on edit post I was unable to add a 'new' attachment when editing a post. No problem replacing an attachment or deleting an attachment that was placed in the post via newthread or newreply.

Therefore I cam up with following few lines that fixed the problem in editpost.php

add this bit of code:

--------------------------
if ($attachment != '' and $attachmentaction < ' ')
{
$attachmentaction = "new";
$postinfo[attachmentid] = 999;
}
-----------------------

before:

-----------------------
if ($postinfo[attachmentid]!=0) {
// check attachment status
// keep, delete, update
-----------------------

Don't worry about the $postinfo[attachmentid] being set to 999 because a new ID is calculated later in in the code by calculating the next available key value in the attachment table primary index.

jjj0923 04-26-2003 07:47 AM

hey Scott, one small question...

why didin't you just use attachmentid as the file name?

- jeff

jjj0923 04-26-2003 08:02 AM

by the way - this is a great hack. My attachments table had grown to over 400 mb alone. I never liked the idea of keeping binary data (blobs) in a sql server table.

I have also created my own hack to use mogrify to automatically reduce the size of uploaded images and avatars on my forum and my users love my site. They have no idea about how their attachments are stored but it's pleasing to me to have them as separate files instead of cluttering up my database.

:)

Preech 04-26-2003 07:02 PM

about 8 million people asked this question

no one answered yet

but

how do you fix this???

"Warning: fwrite(): supplied argument is not a valid File-Handle resource in /home/hhapdotcom/www/airplay/admin/attachment_install.php on line 333"

its in the IMPORT portion.

roninuta 05-02-2003 02:42 PM

Installed on 2.2.9 and working well. Thanks

Nickos 05-06-2003 08:04 PM

my problem


Parse error: parse error, unexpected '}' in /home/xxx/public_html/forums/admin/functions.php on line 1819

here are the lines around there

PHP Code:

    $DB_site->query("INSERT INTO attachment (attachmentid,userid,dateline,filename,filedata,visible) VALUES (NULL,$bbuserinfo[userid],".time().",'".addslashes($attachment_name)."','".addslashes($filestuff)."','$visible')");
    
$attachmentid=$DB_site->insert_id();
  }
  return 
$attachmentid;
}


// ###################### Start getmodpermissions #######################
function getmodpermissions($forumid,$userid=-1) {
  
// gets permissions, depending on given userid and forumid
  
global $DB_site,$bbuserinfo

i cant even get in my admin control panel

Nickos 05-06-2003 08:08 PM

the whole forums are not working now... going to the main oage i get this errors

Parse error: parse error, unexpected '}' in /home/xxx/public_html/forums/admin/functions.php on line 1819

Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/public_html/forums/admin/functions.php:1819) in /home/xxx/public_html/forums/admin/functions.php on line 1573

Fatal error: Call to undefined function: makelogincode() in /home/xxx/public_html/forums/global.php on line 371

Dean C 05-07-2003 03:47 PM

You've applied some part of the hack wrong :)

You have an extra } somewhere

- miSt

Preech 05-11-2003 02:50 AM

Quote:

04-26-03 at 04:02 PM Preech said this in Post #324
about 8 million people asked this question

no one answered yet

but

how do you fix this???

"Warning: fwrite(): supplied argument is not a valid File-Handle resource in /home/hhapdotcom/www/airplay/admin/attachment_install.php on line 333"

its in the IMPORT portion.

anyone ? :(

rake 05-11-2003 07:50 AM

One thing i noticed:
During the installation, set your attachments folder RELATIVE TO THE ADMIN FOLDER, then import the files and then set it relative to your root folder. That will probably fix the above error, assuming the folder is chmodded correctly.

Courage 05-16-2003 08:42 PM

On a new vb 2.3.0 all is working OK, but

If I attach a file, then edit and add a new attachement, on my ftp i can see 2 files. The old file is not deleted !

Courage 05-19-2003 02:44 PM

It seems that suport for 2.3.0 is missing :(

rake 05-19-2003 03:44 PM

Scott missed adding removeattachment() in a few places in editpost.php ;)

Courage 05-19-2003 06:04 PM

@rake

Solutions ? :D

angelo70 05-27-2003 10:48 PM

The user who uses the Advanced Attachmentbox v1.0
HACK:

functions.php
FIND:
$DB_site->query("INSERT INTO attachment (attachmentid,userid,dateline,filename,visible,has h) VALUES (NULL,$bbuserinfo[userid],".time().",'".addslashes($attachment_name)."','$v isible','$attachment_hash')");

and replace it with:
$DB_site->query("INSERT INTO attachment (attachmentid,userid,dateline,filename,filedata,visible,hash) VALUES (NULL,$bbuserinfo[userid],".time().",'".addslashes($attachment_name)."','$filesize','$visible','$attachment_hash')");


Open Showthread.php
Search for this (2 times on a unhacked vB, Line 55 , 410):
attachment.counter

and replace it with:
attachment.counter,attachment.filedata AS attachsize

displays the filesize of the attachments :rolleyes:

Intex 05-29-2003 12:14 PM

Is it possible to get an explanation of what happens during the installation process. Obviously files are going to get saved as attachments, but it doesn't say anything other than that on the thread or instructions. Specifically it would be good to know:
  1. Does this apply to attachments from once this hack is installed
  2. If it does go through the database and store them as files, how do you control where they go?
  3. How are these linked

Thanks for any help.

rake 05-30-2003 03:21 PM

1. Yes. Attachment are ported during the installation process.
2 and 3. Only the [data] is stored in files. Other information related to attachments is still stored in the database.

Intex 06-01-2003 05:18 PM

Thx for the reply rake. However, can you specify what folder these attachment files are stored upon installation / after installation?

minder 06-09-2003 01:17 AM

just installed it on my 230 board with no problems thanks for a great hack

rob

Tim Wheatley 06-13-2003 06:01 PM

Quote:

04-05-03 at 10:42 AM Scott MacVicar said this in Post #302
and there has been 2 users who upgraded to vB3 as well as using this hack, I provided a script to do so and you only need vB 2.2.9 to upgrade to vB3.

Any news on this for the beta 3?

Tim Wheatley 06-13-2003 06:47 PM

As I'm only testing I've empted the attachment table and wiped the line in the post table also, hopefully we can get the conversion for the next version?

Thanks.

ptenthus 06-14-2003 01:48 PM

Any idea when a conversion script to get a production board's attachments into the new vB3 format will be released?

I'd imagine that, even in beta, that this should be something that could be written now (not much chance of a change in data format during the beta process, right?)

gmarik 06-14-2003 04:14 PM

Quote:

Yesterday at 11:01 PM Tim Wheatley said this in Post #340
Any news on this for the beta 3?
The same question. :disappointed:

Tim Wheatley 06-15-2003 06:23 PM

Scott has uploaded it here:
http://www.vbulletin.com/forum/showt...threadid=73467

:)

bitbender 06-16-2003 06:06 PM

THANK YOU. :)

roxics 06-16-2003 07:18 PM

Does this limit file size uploads? What I mean is do you still have to edit PHP to accept larger file size uploads? I'd like my members to be able to attach videos up to 20MB's or more.

bitbender 06-17-2003 04:20 PM

Ok, I must have missed something. I have attempted to follow the path of redemption, and get my attachments working under my VB3.0 beta test. I am one of the hundreds that enjoy the attachments as files hack.
  1. Took a good backup from 2.3.0 and restored it to my test server.
  2. Added the filedata column back to the attachment table via phpmyadmin;
    Code:

    ALTER TABLE attachment ADD filedata mediumtext NOT NULL
  3. Ran an optimize on the attachment table (if I didn't, MySql kept getting 122 table handler errors at insert after a number of inserts)
  4. Ensured that the current value for the VB setting field 'fileattach' was correct, and pointed to said directory where all the attachements were
  5. Executed the attachment_upgrade.php from /vb22/admin directory (no output does it make to the panel, just a blank screen after it runs for about 3 minutes and then says "done" in the lower left )
  6. Verified that 'filedata' column in the attachment table was populated with data via phpmyadmin
  7. Ran the VB3 conversion (upgrade.php) on the DB, and yes, it worked thru the attachments, and then updated another table related to attachements
What I am seeing in my VB3.0 beta is broken links for the attachments. It "thinks" it got them, but in reality the file sizes are zero for the attachements (when you disable viewing of attachements, it gives a handy link with file size instead)

I really, really like what I have seen so far of VB3.0, but I gota beat this 1000 pound gorrilla where the attachments as files hacks is concerned.

Any ideas? If any one wants a look, let me know, as I have it locked down to stay in compliance with the "no public" rule :)

shorty 06-20-2003 05:23 AM

Hello BB .. have you enabled attachments as files in the VB3 backend?

Im gonna run this on my dev board then upgrade it to VB3 later.

I really wanna run it over at Short-media. Been live for two weeks and the forums db is over 300mb already :ermm:

Il let ya know how I get on. You are still on VB 2.3.0 aren't you?

dssstorm 06-21-2003 02:57 AM

I installed the hack and all my dl are 0kb any insite?

bitbender 06-21-2003 12:11 PM

Quote:

Yesterday at 01:23 AM shorty said this in Post #348
Hello BB .. have you enabled attachments as files in the VB3 backend?

Im gonna run this on my dev board then upgrade it to VB3 later.

I really wanna run it over at Short-media. Been live for two weeks and the forums db is over 300mb already :ermm:

Il let ya know how I get on. You are still on VB 2.3.0 aren't you?

You dont have much choice, bud. You HAVE to load the attachments back to the DB, BEFORE you run the VB3 upgrade. The Upgrade.php will process only attachments that are in the data base.

Then, if that part WORKS right, you can go thru the part that moves them BACK to files via the attachment manager functions. But, neither worked, for me.

And I kind of figgured that, if it didn't display them properly and showed all zero file sizes when the attachments had been moved back to DB. When I used the VB3 admincp "backend" (as you are calling it, I have no idea what you meant) to move them back out, of course that failed too.

0 + 0 = 0.

The attachments folder in vb 2.3.0 (yes, I got the attachments as files hack working there, too) is close to 1GB in size.

Any real insight into this matter would be very helpful.

ranger2kxlt 06-21-2003 02:20 PM

Was wondering if this hack is kinda like what vb3 does now? It saves attachments as files and your database size will be greatly reduced correct? But Diskspace will be increase??

The main benefit that i can see and want is ease of transfering to a new server without dealing with the attachments in the database. Let me know.

Sabrina 06-23-2003 09:55 PM

Oh my god, you do not know what this hack has done to my forum! THANK YOU SO MUCH!

I had to disable attachments due to such a large database, anyways, this is a miracle hack!!

Very good work! Best Hack Ever Made!!!

:banana: :banana: :banana:

john_rsd 06-26-2003 03:43 PM

After some problems initially the hack now works on my 2.3.0 test site & I have tried attach, edit & delete attachments.

Although I delete an attachment in a post, or delete the whole post itself, the file attachment still remains in the /home/mystuff/attachments folder

Why does it not delete the attachments at the same time as the thread?

Have I missed something in editing another file?

Thanks

john

skc 06-30-2003 02:22 PM

any idea when the attachments as files hack will be ready for vb3?

WCW Fan 07-15-2003 02:48 AM

Im just wondering if this is even worth installing alot of people have had errors so is it worth installing

ontherun 07-25-2003 05:32 PM

This is a excelent hack, but I need to uninstall it and placed files back into the data base to upgrade to vB 3.0 Beta 4 on my development site.

Is there a easy way ?

ontherun 07-26-2003 05:55 PM

Quote:

06-30-03 at 08:22 AM skc said this in Post #354
any idea when the attachments as files hack will be ready for vb3?
skc vB 3.0 has this hack built in as of beta 4

bitbender 08-07-2003 04:57 AM

WOOOOOTTT!!!

FIxed as of Beta 5 for me !!

W000TTT!!

PARTY ON !! :) ( i know, it doesn't take much for me)

shorty 08-07-2003 05:32 AM

Quote:

Today at 06:57 AM bitbender said this in Post #358
WOOOOOTTT!!!

FIxed as of Beta 5 for me !!

W000TTT!!

PARTY ON !! :) ( i know, it doesn't take much for me)

If this is true.. Im installing this hack tonight!

Thanks for the information BB that it works with beta 5.

bitbender 08-07-2003 02:36 PM

Quote:

Today at 01:32 AM shorty said this in Post #359
If this is true.. Im installing this hack tonight!

Thanks for the information BB that it works with beta 5.

Yep, it IS true !! It was Soo true I did it three times!! (ok, so I couldn't sleep last nite)

Be SURE to follow the instructions closely, and be patient.

MY issue was that even thou I altered the attachpath variable to be the CORRECT value, the cache was still point back to the place I restored it FROM (an invalid path).

So, I flushed cache, and ran again, and log and behold, it worked just fine.


So....here is what I did.
  1. Create a backup (I have a cron script, but it's the same as reccomended by the VB3.0 upgrade)
  2. Create a database for VB 3.0 (if your host only allows one, of course you cannot do this)
  3. Restore the new DB using the backup just made (Skip this is you only have one DB available to you)
  4. Using PHPmyAdmin, add the field filedata back to the attachments table;
    Code:

    ALTER TABLE attachment ADD filedata mediumtext NOT NULL
  5. Run Repair, and Optimize on the attachment table using the functions in PHPMyAdmin
  6. Again, using PHPmyAdmin, select the settings table, and locate the variable attachpath Edit this to ensure you have the CORRECT path there. What's key here is that it is an absolute path;
    Code:

    For my installation it was;
    /home/virtual/site22/fst/var/www/html/vb30/attach_folder

  7. Execute admin/attachment_upgrade.php - On the BBF test Server, a full copy of VB 2.3.0 was already place in the VB30 directory structure, so that prior to the VB30 cutover I could still access it as 2.3.0. The script attachment_upgrade.php depends on the vb 2.x struture to be intact and in place to work correctly. Believe me, I called it's bluff.
  8. Once That completed, I proceeded thru the install/upgrade.php, no issues, or worries, straight thru. It DID take some time, as 1.3 GB worth of attachment files takes a bit of time.

Next up? Pushing them BACK out to the file system, along with the Av's!

PARTY on VB!! I'm renewing today! Totally pleased, am I!


All times are GMT. The time now is 01:11 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.01783 seconds
  • Memory Usage 1,845KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete