First I am newbie working this azure webapps, and I have found this service in partiucular behaves different from a virtual or local server, obviously. I have a php application that loads a pdf file under the wwwroot inside a folder the application does it neatly and we use the following php script:
$name= $_FILES['archivocontrato']['name'];'''
$tmppath= $_FILES['archivocontrato']['tmp_name'];'''
$rootfolder = $_SERVER['DOCUMENT_ROOT'];'''
$fullpath= $rootfolder."/pdf/".$namce;
copy($tmppath,$fullpath);
echo 'File succesfully saved to forlder!'
this part does work and it loads the file and the file gets saved under the directory that is being provided.
However when we try to access it, and to open it via an html element anchor . When we try the click, we get error 404 no found. The following script is being used:
$rootfolder = $_SERVER['DOCUMENT_ROOT'];
$fullpath= $rootfolder."/pdf/contratos/";
$actionButton = '<a href="'.$fullpath'.$row['nombre_archivo']." class="btn btn-dark" target="_blank" ContentType = "application/pdf" role="button"><i class="fa fa-file-text"></i> Ver Desc</a>';
$output['data'][] = array(
$row['Id'],
$row['Title'],
$row['Description'],
$row['fileName'],
$actionButton
);
Why is it done this way, because we use it to populate a table with the list of the pd files. Now both scrip run smoothly on development enviroment no hassle. However when we publish the php application to azure-web-site app and we clic on that anchor we error 404.
Can someone explain if this can be done this way exactly. because let's say there is no budget for storage nor a blob storage it has to be done this way within the aplication forlders. Do we need to configure something else? Do we use something else like another html element?
I made it work aparently we do not need the full path, we shoul always asumme we are at wwwrooot. Basicaly I dropped everything, but the /pdf/ as directory along with the name of the file and presto!