Not allowed to load local resource (windows)

I am trying to download some files to my local C: \ drive and then read and display them. I did the following: in config.php

'route'     => 'C:/',

      

function that gets the path

function object_get_upload_path($type,$id){
    $config = app_db_get_config();
    return sprintf($config['route']."uploads/%s/%s/%d/", $_SESSION['active_db'],$type, $id);
}

      

The problem is when clicking on a link that gets the file path and displays it:

Not allowed to load local resource: file:///C:/uploads/MARO_KONDI_AL/objekte/48167/laura1e11c10053fd1c6e5dca911103e5c3ae90072.jpg 

      

+3


source to share


1 answer


Basically, if you want to upload a file, you need to use the function file_get_contents()

. Then you have to look at the server side for the correct syntax.

I believe the following would be correct:



$config['route'] = 'C:/'; // or $_SERVER['DOCUMENT_ROOT']
$display = file_get_contents($config['route'].'uploads/'.$_SESSION['active_db'].'/'.$type.'/'.$id);

      

0


source







All Articles