Welcome Guest, Not a member yet? Register   Sign In
File Upload Helper - absolute path vs relative path
#1

[eluser]joneslee[/eluser]
Hi there,

I am now learning how to use the file upload. As I've known, $uploaded_data['file_path'] is an absolute path. eg /www/dev_site/site/mooksrds/public_html/testing/. Is there any way to retrive just the relative path .eg /testing?

Many thanks,
#2

[eluser]LagniappeInternet[/eluser]
Code:
$relative_url = str_replace ( $_SERVER['DOCUMENT_ROOT'], "" , $uploaded_data[‘file_path’]  )

So if the upload was /www/dev_site/site/mooksrds/public_html/testing/
and the Doc root was /www/dev_site/site/mooksrds/public_html
$relative_url should = /testing/




Theme © iAndrew 2016 - Forum software by © MyBB