Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Attachments

1356710

Comments

  • Thanks for the great example. I get it now.
  • @JDW
    Yes. You make one "uploads" folder and Attachments does the rest. The word in-between the %-signs (and including them) are all one variable. From the extension's setting page:
    Upload Settings
    The path to the upload directory should be an absolute path. Use a path outside your webroot for better security. Remember that the folder should be writable. You can use the following replacement tags: %day%, %month%, %year%, %userid%
    It supports those four variables in whatever configuration you want to make inside your uploads folder. Suppose that User #53 uploads "picture.jpg" on 12 April 2007. If the path looks like this to Attachments:

    www.jdwdomain.com/forum/uploads/%userid%/%year%--%month%--%day%/

    Then the folder structure it creates will look like:

    www.jdwdomain.com/forum/uploads/53/2007--4--12/picture.jpg

    It will make more folders as needed when the variables change (new day, different user, etc.). Remember the path you need will vary depending on your hosting. You can try what Rysk said if it Attachments doesn't put it in there automatically for you.
  • I just solved a problem I was having with Attachments and thought I would post it here in case anyone else was having similiar difficulties.

    Sometimes when attempting to upload a .doc I would get the message:

    Some problems were encountered
    You are not allowed to upload (test genesis doc.doc) the requested file type: application/octect-stream


    I saw the hint here about adding file types to the 'allowed' list, but the file type it was having a problem with already seemed to be listed.

    In fact, application/octet-stream is already listed, application/octect-stream is not. Duplicating the application/octet-stream line of code and adding the 'c' solves the problem.

    I guess one or other ('octect', judging by a quick google search) is a typo? And I don't know where it's originating, in which case I guess this is a workaround rather than a proper fix, but hey-ho.
  • Qoute: alan
    In fact, application/octet-stream is already listed, application/octect-stream is not. Duplicating the application/octet-stream line of code and adding the 'c' solves the problem.


    thanks for sharing Alan.. typical problem that would take ages to notice :)
  • Friends, many thanks for all the replies about the path (especially pbear, for making it abundantly clear and in color too)!

    Now that my database problem has been solved, I've restored all the Vanilla files to my server from my first Vanilla installation, which included all the extensions and php code changes I had made to make the extensions work. I can now save my Admin preferences with any errors, and everything seems to work well, EXCEPT ATTACHMENTS! Ack!

    I now get this Fatal Error message when trying to save attachments. But even more worrying is that this Fatal Error occurs even when I try to start a new discussion WITHOUT saving any attachments! I even get that Fatal Error when trying to view discussions! But if I turn off the Attachments 2.1 extension, I can then create and view discussions again with no fatal errors.

    I pulled up phpMyAdmin and checked, and yes that Fatal Error is correct in that the "lum_attachment" table is not in my jdwages database (although many other "LUM..." tables are in my database). Okay, so I know that not having this "lum_attachment" table is the root problem, but I haven't the faintest idea how to create it. Shouldn't Attachments 2.1 do that for me automatically? I tried disabling and then re-enabling the Attachments 2.1 extension multiple times, but "lum_attachment" is not being created in my database.

    Would anyone know how I should go about solving this problem?

    Thank you!
  • in php, click somewhere it says SQL, wich means u can run SQL commands. run this: CREATE TABLE `LUM_Attachment` ( `AttachmentID` int(11) NOT NULL auto_increment, `UserID` int(11) NOT NULL default '0', `DiscussionID` int(11) NOT NULL default '0', `CommentID` int(11) NOT NULL default '0', `Title` varchar(200) NOT NULL default '', `Description` text NOT NULL, `Name` varchar(200) NOT NULL default '', `Path` text NOT NULL, `Size` int(11) NOT NULL default '0', `MimeType` varchar(200) NOT NULL default '', `DateCreated` datetime NOT NULL default '0000-00-00 00:00:00', `DateModified` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`AttachmentID`) );
    btw, its found in the extensions/Attachments/default.php
  • I have never seen anyone have problems like JDW does.
    absolutely nothing is working for him and yet he is persistent in wanting to running vanilla.
    u should consider other forum packages as well
  • yea he does seem to have trouble with everything. last big thing was his host. change host before vanilla :)
  • Mr Do,

    Thank you for the advice. I opened /extensions/Attachments/default.php and found the exact code to which you are referring. But again, I ask the same question: if this code exists, why should I have to manually type it in? Why isn't default.php doing the job it should do in creating that LUM_Attachment table? I guess that is a question no one can answer.

    Per your advice to "click somewhere it says SQL," I loaded phpMyAdmin, pulled up my jdwages database and then viewed the menu tabs. Those tabs read as follows:

    Structure SQL Search Query Export Import Operations

    I assumed that "SQL" is what you were referring to, so I clicked on it. I the saw the text below, followed by a large field:

    Run SQL query/queries on database jdwages:

    Clearly, a "query" is not a "command," but following your advice I pasted in all that CREATE TABLE code and then clicked the "Go" button. (And here's a screen shot for you.) Not surprisingly, it resulted in a lengthy error message (see this screen shot -- you can also see all the LUM tables at left; the 3 tables above and 3 below the LUMs are tables for another function on our server not pertaining to Vanilla).

    So I'm stuck at this point, still asking myself why in the world the Attachments 2.1 extension isn't doing all this for me!

    Any further specific recommendations you can offer would be greatly appreciated.

    Thank you.
  • you did everything correct. i wrote it wrong the first time, but imidiatly fixed it. so i assume u either copied from the file or from my wrong version in those few seconds. anyways. this part is PHP and shouldnt be part of any sql u put directly into phpmydamin.".$Configuration['DATABASE_TABLE_PREFIX']."
    the correct is written in my post above. its suppose to be LUM_. If u look up the DATABASE_TABLE_PREFIX in your config, thats what it will say

    Dear JDW, I dont mean to be mean or judgemental, but from the amount of problems you have, and the lack of understanding in order to fix them yourself, I your probably not the right man for this job. Either hire or ask a friend or someone to do this for you.
  • Mr Do,

    Many thanks for correcting my oversight of your code. Last night, I had in fact copied the code out of the /extensions/Attachments/default.php file you referred me to instead of copying your code out of this thread. Now that I have copied the correct code, it works perfectly! The "LUM_Attachment" table is now created, and I can enable Attachments 2.1 and post new discussions without the Fatal Error message! (I'm still very curious as to why this LUM_Attachment table was missing and why Attachments 2.1 couldn't create or re-create it, but now that I have created it, and since no one seems to know, I won't dwell on that point.)

    Unfortunately, I still cannot save attachments, even as an Admin. I can save new discussions and comments, but any attachments that I try to save with those discussions or comments will simply not appear in the discussion or comment. I've set the permissions on my /forum/uploads/ folder to 777, so that isn't the problem. The file I tried to attach/upload was a tiny GIF file. I've also checked Extension Options > Attachments Settings > Upload Path and confirmed it is as follows:

    /home/xxx/yyy.com/forum/uploads/%userid%/%year%/%month%/

    I even tried using the following path (no tags), but it didn't make the attachments appear:

    /home/xxx/yyy.com/forum/uploads/

    And yes, I used my FTP client to verify that the /forum/uploads/ directory is indeed empty (no attachments saved in it, nor any folders). I also verified that I have both settings ticked (enabled) in my Admin role: Add attachments & Manage attachments

    Any further thoughts in light of this?

    -------------------------------------------

    Mr Do, although I read your comment to MySchizoBuddy about me last night, I decided it would be best if I didn't comment on it. But since you bring up the point again today, and now sending it to me directly, I really have little choice but to offer you my complete thoughts on the matter. My intent here is not to offend you anymore than your intent was not to offend me.

    With that said, please know that if my professors in engineering school had told me "James, you lack the ability to become an EE -- why don't you become a history major instead," I would have likely lost all heart and given up. But thank God my instructors lauded questions and promoted gumption and endurance. I made it through engineering school and although I am by no means the world's best electrical engineer, the experience served to show me that I can do pretty much what I set my mind to.

    The issue really is one of how I compare with others in the minds of you kind people on this site. You have offered tremendous assistance to me, and for that I am grateful and have tried to show that respectfulness to you in all my posts, giving due credit and thanks where appropriate. But your feelings about me most likely stem from the fact that I am "unique" among those who come here to post. And about that, I am not surprised. In my many years of posting in support forums, I have found that most people with problems "give up" early on. Most people won't take the time to write out every last detail in support forums or otherwise work with others toward solving a problem. But such attitudes are selfish, in my opinion. Why? Because of all the poor souls who later come to the forum seeking help on the same topics. That's precisely what I did when I came to this site. You will notice that I didn't start off by starting new threads without having first scanned this forum for people who had similar problems!

    I've written about my problems in detail for two reasons: (1) so kind people such as yourself can better understand my problem and provide a better solution in a shorter amount of time, and (2) so that other people who follow in my footsteps will come to the site and find the solution to their problem straight away. I have no regrets about my participation in this forum thus far.

    I would also like to combat the misnomer that I have problems with "everything" concerning Vanilla. That is totally untrue. I simply do not post about every single thing that works because, well, I shouldn't have to. Therefore, you only are reading about the problems I have on this site, and honestly, if I had no problems, I probably wouldn't be posting here! Nor would I be posting here if I didn't want to find a solution to those same problems. The problems I have do NOT lie with my service provider, so please, let's stop dwelling on that. Please. The problem I had with my server wasn't so much my provider's fault as it was mine. I simply was not aware that I had been moved from one server to another and the files on the older server had been deleted, and I had been logging into the older server which showed no tables in my jdwages database! You can clearly see why that would have created troubles for me. But that is out of the way, and there are no other problems that we can lay blame to my provider on.

    To conclude, I wish to simply say that I have been assigned the task of creating a forum for our site at work, but I am in the unfortunate position of not also having been assigned a budget to pay someone else to do the job. If I had the budget, I would certainly be paying someone to setup a full phpBB forum for us, with all the bells and whistles. But because a close friend of mine (a PHP programmer) recommended Vanilla to me as something he felt that I could probably "do myself," I came here. I would not have known about or considered Vanilla if it were not for him. And despite my problems, I still and thankful to my friend for making the suggeston. Because with the helpful suggestions that everyone (especially yourself, Mr. Do) is making, I am slowly fixing the problems one by one, seeing a little light at the end of the Vanilla tunnel.

    I greatly appreciate the time all of you have taken to assist me, and I sincerely hope that help will further the Vanilla community by assisting many others who come to this site seeking the same wonderful assistance I have been so kindly given. Thank you.
  • JDW : Have you given yourself all the appropriate role permissions needed to post with attachments? There is also the thing in extensions/Attachment/default.php where you must enable the file types you wis hto be able to upload on your forum. There seems to me to be some inconsistencies here when it comes to file extension and mime-type, but basically the way to success here is to read the error messages and add the mimetype and file extension. The lines I refer to here are: $Context->Configuration['ATTACHMENTS_ALLOWED_FILETYPES'] = array ( 'image/gif' => array('gif', 'GIF'), 'image/png' => array('png', 'PNG'), 'image/jpeg' => array('jpg', 'jpeg', 'JPG', 'JPEG'), 'image/pjpeg' => array('jpg', 'jpeg', 'JPG', 'JPEG'), 'application/pdf' => array('pdf', 'PDF'), 'application/x-pdf' => array('pdf', 'PDF'), 'application/msword' => array('doc', 'DOC', 'rtf', 'RTF'), 'application/asp-unknown' => array('zip', 'ZIP'), 'application/zip' => array('zip', 'ZIP'), 'application/x-zip-compressed' => array('zip', 'ZIP'), 'application/octet-stream' => array('rar', 'RAR', 'doc', 'DOC','w3d','W3D'), 'text/plain' => array('txt', 'TXT'), 'application/x-gzip' => array('gz', 'GZ', 'tar.gz', 'TAR.GZ'), 'application/download' => array('rar', 'RAR'), 'application/x-shockwave-flash' => array('swf', 'SWF'), 'application/x-director' => array('dcr', 'DCR'), 'video/quicktime' => array('mov', 'MOV'), );

    ---

    Dear Mr JDW, I apologize for my arrogance. You are perfectly correct in your statement. And you behave in the proper way for someone asking assistance, and that is probably also why you have received so much of it. I applaud your persistence and I will continue to help you as best I can. Lets get that forum of yours up and running! :)
  • Mr Do,

    I greatly appreciate your time in offering me further assistance. Per your advice, I opened /extensions/Attachments/default.php and compared the filetypes section with the list you provided. Since your list contains a few more lines than were in my default.php file, I copied your code and pasted it in my default.php. I saved the default.php file (using TextWrangler) to my server. I then gave default.php 777 permissions (even though I don't need to do that). I then verified that do in fact have the Attachments 2.1 extension loaded and that my Administrator role has "Add attachments" and "Manage attachments" ticked (enabled). Under "Extension Options" my "Upload Path" is as follows:

    /home/xxx/yyy.com/forum/uploads/

    And the /uploads directory has 777 permissions. Maximum filesize is set to: 512000. "Path to your old attachments folder" field is blank. I also have a .htaccess file in my /forum/ directory which has the following line:

    SecFilterRemove 300015

    My reasons for disabling mod_security are explained in detail here.

    Despite all this, when I login as an Admin and then create a new discussion or comment with a small filesize attachment (I've tried small GIFs and PDFs), the discussion/comment is created but without the attachment. No error message is given, and no errors appear in my server log either. The attachment simply does not show up. And again, when I look inside my "uploads" folder via my FTP client, there is nothing in it.

    Just to be sure, I edited my Admin role to disabled both Attachment options. I then disabled the Attachments 2.1 extension. I then deleted the /extensions/Attachments folder from my server. I then downloaded Attachments 2.1 again, installed it in /extensions, enabled the extension in my forum, then edited my Admin role to have those two Attachments options enabled. I created a new comment with a jpg attachment. The comment was created but the attachment was no where to be found. Checking inside the /forum/uploads/ folder showed no files at all.

    A perlexing problem indeed!
  • you do get the most amazing magical errors. I have applied for membership on your forum. please give me a role with attachment permisson
  • he is sooooooooooooooooooo persistent. he keeps trying ad infinitum

    Wife cheats a million time, yet Husband still trying to make the marriage work.
    :)
  • Mr Do,

    Many thanks for your assistance. I awoke this morning and was pleasantly surprised in finding that you had indeed saved attachments in my forum!

    I tried a test again in Safari 2.0.4 (under OS 10.4.9) and found that I still could NOT add attachments. However, I then fired up Firefox 2.0.0.2 (also under OS 10.4.9) and found that my attachments could be saved! Aha! So we have a bug in Attachments 2.1 or Safari 2.x that prevents the saving of file attachments in Safari! (I apologize for not having tested in Firefox early on, as that would have made this discovery sooner.)

    I will therefore simply need to make a note to my forum members that Safari users cannot add attachments and they would need to use Firefox instead. That may not sit well with some Mac users, but it's the only option unless Jazzman can find a workaround in the next version of Attachments.

    A thousand thanks, Mr Do, for your kindness in working with me to spot the root problem!
  • Its no hassle JDW. glad we got it in the end :)
  • I dislike pointing out a problem without offering a solution, however...

    If it does not work in Safari there must be some non-standard mechanism being employed.
    I upload files using Safari all the time using php-powered forms.

    Posted: Sunday, 8 April 2007 at 3:11PM

  • Wanderer, I would like to confirm what you mean. You are using Safari to upload to other php forums? Or are you saying that you installed Attachments 2.1 to your Vanilla forum and found that you could upload attachments to your Vanilla forum with Safari? Because I've tried uploading with Attachments 2.1 using Safari on two different Macs, using two different internet connections, and it won't work on either machine. But it works fine in Firefox for the Mac. I personally think this is simply a bug in Attachments 2.1, because Safari is really a pretty good browser and is compatible with most sites that I visit, including forums that allow you to upload files.
  • No never used the attachments extension, just other PHP powered forms.

    Posted: Sunday, 8 April 2007 at 5:32PM

Sign In or Register to comment.