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)

Scott MacVicar 02-21-2002 07:51 PM

yeah you done alot of help when it was in beta :)

I'll go modify my evergrowing sig

Wayne2k1.com 02-22-2002 06:36 AM

Great.

Works perfectly :D

mvigod 02-23-2002 05:16 PM

does this still work "as is" in 2.2.1 or do I need to take away that visible code?

I have so many hacks it would take forever to upgrade to 2.2.2 so I'm stuck at 2.2.1 until 3.0 maybe where alot of these hacks might already be in that version hopefully.

Would love to shrink my database with this hack.

Scott MacVicar 02-23-2002 08:54 PM

you can leave the visible in, it won't have any effect on the hack just selecting it from the table.

If you want to upgrade from 2.2.1 to 2.2.2, I have posted a changes in all the files so you can upgrade to 2.2.2 just by applying all the changes instead of apply all the hacks again.

Destee 02-24-2002 02:00 AM

Hello PPN ... it's not working for me. I've loaded/unloaded 4 times and can't see what I'm doing wrong. Let me start at the beginning ...

1. This is on a test forum, upgraded to 2.2.2 fine. Then I installed the hack. First error I encountered was when I tried to run step 8, importer. I rec'd the following error(s):

Warning: Supplied argument is not a valid File-Handle resource in
/usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/admin/att
achment_install.php on line 333

Imported common1.jpg


I moved on because it's not (absolutely) necessary that those files be imported.

2. Uploaded a few files (.wav) successfully. They are in the newly created attachments directory, but when I try to view them I receive the following errors:

Warning: open_basedir restriction in effect. File is in wrong directory in
/usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php on line 61

Warning: fopen("/usr/local/plesk/apache/vhosts/prettyblackgirl.com/attachments/8f3f831e0564790a88584703c352883f.file","rb") - Operation not permitted in /usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php on line 61

Warning: Supplied argument is not a valid File-Handle resource in /usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php on line 62

Warning: Supplied argument is not a valid File-Handle resource in /usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php on line 63

Warning: Cannot add header information - headers already sent by (output started at /usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php:61) in /usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php on line 64

Warning: Cannot add header information - headers already sent by (output started at /usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php:61) in /usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php on line 65

Warning: Cannot add header information - headers already sent by (output started at /usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php:61) in /usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php on line 66

Warning: Cannot add header information - headers already sent by (output started at /usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php:61) in /usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php on line 67

Warning: Cannot add header information - headers already sent by (output started at /usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php:61) in /usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php on line 68

Warning: Cannot add header information - headers already sent by (output started at /usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php:61) in /usr/local/plesk/apache/vhosts/prettyblackgirl.com/httpdocs/forums/attachment.php on line 80


These errors are given even when trying to view attachments that were in the forum prior to installing the hack.

3. I am able to upload .wav files but not .gif or .jpg. I was able to upload/view all attachments prior to installing the hack. When I try to upload a .gif or .jpg I get the following error:

The uploaded file is not a valid GIF or JPG file. Please ensure that it is and try again.

Like I said above, I've went through the process a few times but the errors remain. I'm running Plesk and the errors above are similar to some seen in the past and corrected back then too.

Any suggestions?

Thanks,

Destee

Vivi Ornitier 02-24-2002 05:16 AM

ummm .. . can someone PLEASE upload like a text file with the SQL Queries in it cause the php file gets this parse error in line 344 and i'm not too good with php

Line 344:

echo "</table>\n";
echo "<br><br>\n";
echo gotostep(6,0,1);
}

// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

It's the line between the } and the //@@@@@...

So yea, can somone please upload a text file of some sort? unless u can help me fix this error, i'm on 2.2.2

Scott MacVicar 02-24-2002 07:57 AM

Your problem with being unable to view files it due to the way your php is configured, I'll look into a solution for it now. The problem is simply that the script doesn't have permissions to read a file from a different directory.

Did you go to the admin panel and set the folder where attachments are to be stored and give it 666 permissions?

Destee 02-24-2002 04:06 PM

Hi PPN ... the answer above is for me, right? :) Thanks for responding. Yes the attachments path is in the CP. I had originally set the folder to chmod 777 but changed it to 666 after reading the above ... and am still receiving the errors.

Destee

Vivi Ornitier 02-24-2002 04:54 PM

which folder is attachments suppose to be stored? I don't see any folder in the FTP.

Destee 02-24-2002 06:14 PM

Vivi ... hope this helps ...
Quote:

create a directory below your document root, if you can, this means if you login to ftp and you see a httpdocs, wwwroot, www or public_html folder this is below document root. Create a directory here and give it 777 permisions if you are on a unix server. You can call the folder whatever you want, i simply called it attachments. If you have to place it above document root then give it an obscure name such as att4chm3nt5.

Vivi Ornitier 02-24-2002 06:41 PM

okay, u've confused me even more now with the wwwroot and whatnot but thanx anyway. I just created a folder called attachments in my forums folder, like forums/attachments/ and chmoded to 777, is that wat ur suppose to do? I dont' see any httpdocs, wwwroot, www or public_html folders. I MUST have this hack!

Destee 02-24-2002 08:45 PM

Vivi ... the quote above comes directly from PPN's install file, didn't mean to confuse you more. I suppose creating forums/attachments will work but notice in the quote above we're advised to give the directory a more obscure name (if going that way). I'm hardly an expert at this and am having a few problems getting this hack to work myself. Perhaps someone else may be able to give you more helpful support. Good Luck.

Destee

Vivi Ornitier 02-24-2002 10:55 PM

the thing is it won't even run period, all i want is someone to write like a text file of the hack with like the mysql queries in it so it makes my life all the much easier! :D

Destee 02-26-2002 06:54 PM

Hi PPN ... I don't mean to be a pest ... but any progress on how I can resolve my issues with this hack?

Thanks,

Destee

Scott MacVicar 02-26-2002 07:13 PM

Destee, i've looked over the hack and the only thing which will return those problems are that the directory itself doesn't exist, ie you have the path wrong, or php doesn't have access to that folder, in other words that the users are different.

Destee 02-26-2002 07:32 PM

Oh Boy! Oh Boy! Oh Boy! :D Thank You PPN for directing me in the right way! It's working now! The problem was exactly as you described, php didn't have access to that folder! I moved my "attachments" folder to the root directory and everything is working properly now!!!! Oh Boy! Thank You! :)

Destee

ps ... I just went back and did the import step included in this hack and it worked too ... with no errors! Thanks again! :)

Scott MacVicar 02-26-2002 08:30 PM

no problem :P

Sorry it took so long, it was just a rather odd error :)

Scott MacVicar 02-26-2002 08:31 PM

If you are having an error uploading the attachment_install.php file then please do the following, check that you uploaded the file in ASCII and that ?> is at the end of the file. Its been clipped for some people.

Vivi Ornitier 02-26-2002 09:03 PM

YAYAYAYA it works!! that's all u needed to write actually! ?>

Scott MacVicar 02-26-2002 09:32 PM

for some reason it shows on mine though, thats now 3 people that have had the end tag clipped from the file.

mup_cow 02-27-2002 08:59 PM

It would be nice if this functionality is included in the standard VB I mean put the attachment into an attachment directory (off the docroot), and perhaps some options as to whether it should use the real name (allowing / disallowing duplicates) or hashed version.

attachments into the DB is making the DB so big :( taking a long time to backup / restore it.

mup_cow 02-27-2002 09:23 PM

Is there a hack to extract all the existing attachment from db into files ?

maverick1236 02-28-2002 12:50 AM

test

maverick1236 02-28-2002 12:54 AM

Looks like a great hack-i get all the way through to step one in functions php

then i crash when i add this

//we got this far, attachment passes the tests
//the file should now be in the directory lets simply insert the data into the database
$visible = iif($moderate,0,1);
$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')");
$attachmentid=$DB_site->insert_id();
}
return $attachmentid;
}

// ###################### Start removeattachment #######################
function removeattachment ($attachmentid) {
global $DB_site,$attachpath;
$fileinfo = $DB_site->query_first("SELECT attachmentid, hash FROM attachment WHERE attachmentid='$attachmentid'");
$path = "$attachpath/$fileinfo[hash].file";
unlink($path);
}



any ideas why this crashes my board?

tx! :D

mup_cow 02-28-2002 06:35 AM

Quote:

Originally posted by mup_cow
It would be nice if this functionality is included in the standard VB I mean put the attachment into an attachment directory (off the docroot), and perhaps some options as to whether it should use the real name (allowing / disallowing duplicates) or hashed version.

attachments into the DB is making the DB so big :( taking a long time to backup / restore it.

Sorry I hadn't got to the part where it imported the attachments from the table into the files.... hehehe it makes this hack sper duper cool

48MB -> 84KB :) Thanks for making this hack!!!

maverick1236 02-28-2002 09:34 AM

BUMP

Scott MacVicar 02-28-2002 01:59 PM

maverick your applying the patch wrongly, make sure that you are doing it correctly you should completely remove the accept_attachments function and then replace it with the ew one.

maverick1236 03-01-2002 09:36 PM

this hack wouldnt work for me

in fact it TOTALLY screwed my board up-and i am quite experienced at applying hacks

ive uninstalled the hack-and am using vb default php files

and guess what?-my attachments dont show---period.

nothing shows

now people think they are uploading an attachment-and no errors occur-but no file either-so they post 3 times trying to upload it-and NOTHING

i dont get it-how could such a simple hack do so much damage

:mad: :( :mad: :(

Linux 03-02-2002 07:40 PM

Hi, thanks for this hack it is a rock

But I have a problem with the imported files, after installation every things work well. but when I checked the attachment folder I noticed there are a duplication in most of files, yes it has different name but there are 3 or 4 copy of each file, so is there any way to determine unused file and delete them to save the space

Scott MacVicar 03-02-2002 09:06 PM

the files can't be the same, they wouldn't be able to exist as they would have been overwritten. The files may look the same as it uses a md5 hash to create it.

mvigod 03-02-2002 09:16 PM

Quote:

Originally posted by mup_cow
It would be nice if this functionality is included in the standard VB I mean put the attachment into an attachment directory (off the docroot), and perhaps some options as to whether it should use the real name (allowing / disallowing duplicates) or hashed version.

attachments into the DB is making the DB so big :( taking a long time to backup / restore it.

I second this idea....my database is growing like a beast. Just 35MB's w/out the attachment table and 200MB with it. It is now growing at 2MB-4MB per day! The option to break off attachments would be great. I am working on a backup that will save all tables minus attachments and uneccesary index tables that can be rebuilt if needed. Downside is if disaster strikes all attachments are gonzo.

HeadStAtE! 03-04-2002 04:29 PM

Thanks for the hack.

It was fairly painless to install and works great!

Aaow AnD wHiTe 03-05-2002 09:41 AM

We're a little bit confused :S So it finally can just do a backup of the attachments withour removing them from the database, just so we can have the binaries from the DB?

Thx for your hard work, PPN :)

Scott MacVicar 03-05-2002 03:01 PM

once you have imported the attachments to files you can simply drop the filedata column and this will reduce your attachments table to kb instead of mb. Though you will have to remember to backup the attachments folder on your server every once and a while. I simply gzip it then download it to another server, cause then i get about 2mbps.
With database backups you still need to include the attachments table as this holds the file hashes and other stuff, just it won't be so large.

Aaow AnD wHiTe 03-05-2002 03:23 PM

Uhm... that's not what we mean. We'll try again :)

At this moment, what we want to do is just to have our attachments as binaries in another folder, without changing anything to the way vB stores attachments and without removing them from the DB. Just like a big backup of all the attachments.

Hope you understand us now :__ )

Scott MacVicar 03-05-2002 04:22 PM

hmm i guess i'll do this and release it as a hack, would be kinda useful will be back in about 15mins with this done :D

Gamingforce 03-05-2002 07:35 PM

Hi, I am trying to import my files but I get the following error:

Warning: Supplied argument is not a valid File-Handle in ../attachment_install.php on line 333.

I am running vBulletin 2.2.0. Thanks!

Scott MacVicar 03-05-2002 09:40 PM

did you set the attachment path in the settings part of the control panel, chmod the folder to 666 and check that the script user is the same as the folder, ie. same linux user.

Gamingforce 03-06-2002 01:32 AM

Yes, I set all of those however I remember trying out this hack originally when it first came out in beta. For some reason I have two file path fields in the admin options section. Could that be causing the problem? When I tried it out today, I put both fields with the correct path just to be sure.

mojotim 03-06-2002 09:46 AM

Nice one, thanks!


All times are GMT. The time now is 04:20 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.01802 seconds
  • Memory Usage 1,829KB
  • 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_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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