0

I've got a file upload location that needs to serve files via http in the public part of the website, and serve files via https in the private part of the website and in the control panel (to avoid getting security warnings).

How can I handle this in EE?

Here's how I'm currently specifying file upload locations in the config.php file:

/* File Upload Preferences
-------------------------------------------------------------------*/
$config['upload_preferences'] = array(
  1 => array(
    'name'        => "Uploads",
    'server_path' => "${_SERVER['DOCUMENT_ROOT']}/uploads/",
    'url'         => "http://${_SERVER['HTTP_HOST']}/uploads/"
  )
);
3

Try using the protocol neutral implementation, so

/* File Upload Preferences
-------------------------------------------------------------------*/
$config['upload_preferences'] = array(
  1 => array(
    'name'        => "Uploads",
    'server_path' => "${_SERVER['DOCUMENT_ROOT']}/uploads/",
    'url'         => "//${_SERVER['HTTP_HOST']}/uploads/"
  )
);

Basically, this should allow either protocol to specified. The actually spec is called 'Protocol-Relative' you can read about it.

IE6 have some issues with JS being loaded by URLs without protocol. And IE8- downloads css twice, if they don't have protocol. But you're fine to use them on images and other files.

This not work on EECMS 2.5.2, but now it's fixed.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.