HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Uploads location and access by vanilla

edited May 2015 in Feedback

Hi all. I've been going around in circles for a few days now and reading through the threads on the forum here has helped me a lot but I'm getting caught out by how Vanilla accesses uploaded files.
I've finally worked out how to create the bootstrap.before.php file and i've added this line to it to ensure the uploaded files go to a top level destination:
<?php
define('PATH_UPLOADS', '../uploads');

However, whilst Vanilla delivers the files to the right location it actually fails to display the picture so I'm assuming there must be another line of code somewhere that calls the files back. So my question is. Where is this line of code please?
I've scoured the config.php and constants,php files and cannot find it there and I'm not sure where else to look.

Any help or pointers will be gratefully accepted.

Oh the reason for my wanting the uploads in a top level folder is so I can run a separate mobile vanilla on the same server which can also access the upload folder. The reason I want to run a sepaerate mobile version is that my desktop (version) header files do not work well in the auto-mobile version.

Thanks in advance for any help you can offer - Sam

Comments

  • I would avoid doing this. You could symlink the uploads directory.

    There is no actually point in relocating the upload directory anyway, you aren't protecting infrastructure.

    It won't display becuase a web framework don't control your server rules, you do. Url and file path are not the same concept.

    grep is your friend.

  • The reason I want to run a sepaerate mobile version is that my desktop (version) header files do not work well in the auto-mobile version

    ??? you realise you can have a custom mobile theme?

    grep is your friend.

  • edited May 2015

    Yes ive created a custom mobile these but in a separate vanilla copy. Are you saying I can have a custom mobile theme other than baseline's detect mobile theme and keep my own custom desktop theme as well?

  • It won't display becuase a web framework don't control your server rules, you do. Url and file path are not the same concept.

    There must be a line of code in Vanilla that is calling the pictures though as it is now uploading them fine. any system should be capable of calling on an accuratly located file surely?

  • @SammySwift said:
    Yes ive created a custom mobile these but in a separate vanilla copy. Are you saying I can have a custom mobile theme other than baseline's detect mobile theme and keep my own custom desktop theme as well?

    Yes. Add $Configuration['Garden']['MobileTheme'] = 'themename'; to your /conf/config.php file.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • @SammySwift said:

    There must be a line of code in Vanilla that is calling the pictures though as it is now uploading them fine. any system should be capable of calling on an accuratly located file surely?

    vanilla will create img urls scheme relative to the forum directory. so it will strip PATH_UPLOADS from the absolute location, then prefix the forum url.

    @SammySwift said:
    Yes ive created a custom mobile these but in a separate vanilla copy. Are you saying I can have a custom mobile theme other than baseline's detect mobile theme and keep my own custom desktop theme as well?

    yes

    grep is your friend.

  • @x00 said: vanilla will create img urls scheme relative to the forum directory. so it will strip PATH_UPLOADS from the absolute location, then prefix the forum url.

    Is there any way of stopping it from doing that?

  • @hgtonight said:
    Yes. Add $Configuration['Garden']['MobileTheme'] = 'themename'; to your /conf/config.php file.

    Thanks I'll give it a try. but how will it cope with plugins such as 'Pockets' which is what I use to display my html?

  • edited May 2015

    Surely though the ability for Vanilla to access externally located folders such as uploads would be a real bonus for when it comes to do fresh installs or major upgrades? i have about 7 years of historical uploads that I'm likely to lose in my transfering from v.1 to v.2

  • BleistivtBleistivt Moderator

    @SammySwift said:
    Surely though the ability for Vanilla to access externally located folders such as uploads would be a real bonus for when it comes to do fresh installs or major upgrades? i have about 7 years of historical uploads that I'm likely to lose in my transfering from v.1 to v.2

    The Porter strips the /uploads/ path and converts your attachments table so that your old uploads will remain if you have the FileUpload plugin installed.

  • FileUpload is totally screwed on 2.1.10 as far as I can see - its throwing me out of being signed in and tells me page not found when i try to upload with it.

    Frankly I'm depressed the whole Vanilla 2 system seems totally bonkers compared to Vanilla 1, I'm almost at the point where I abandon it and revert back. What a shame!!!

  • x00x00 MVP
    edited May 2015

    @SammySwift

    Your approach is the wrong solution from the offset. Vanilla is designed a transportable framwork as self contianed system.

    If you really need to share folders the solution is to use symlink.

    However you reasons for doing this don't make sense.

    grep is your friend.

  • My reasons for wanting to do this makes perfect sense (to me). I've been running vanilla 1 since 2007. I have an installation of V1.03 and an installation of V1.4. both calling the same database as multiple installs can (but not sharing an upload folder). As a safety net I left V1.03 running in the background.

    Earlier this year my V1.4 got infected with a virus or spam attack of some sort which took out the whole server until my folder containing V1.4 was de-activated. However, I was able to go back to using the original system and my forum users suffered no more than a 24 hour outage. Therefore under the circs I want to ensure that I have a fallback system in the future too but i also want to try to provide a shared folder.

    Is it possible to point me to a discussion that might walk me through the creation of a symlink please?
    Cheers, Sam

  • x00x00 MVP
    edited May 2015

    It is not making sense to me and I have experience with servers.

    You would need shell access to create symlinks, if you are on a shared host you probably won't have this level of access.

    When you said you run multiple instance under the same database, I presume you mean you used a different table prefix? Or were your sharing data too?

    You wouldn't share databases if you had power to create databases.

    If your site gets infected. Having a standby doesn't mean your standby isn't infected too. Or you uploads, or you data.
    You are running V1 which doesn't get security updates any more, so you are vulnerable simply by using it.

    grep is your friend.

  • x00x00 MVP
    edited May 2015

    What you need is different backup procedures.

    • An image backup for absolute last resort (host may do this).

    • Sql dumping (cron job would normally suffice)

    • And a file backup, possibly to external drive or third party service.

    Your solution is inadvisable, and does not enable you to follow good security practices.

    grep is your friend.

Sign In or Register to comment.