Below is the code for me to generate a unique file Url of each image uploaded and store it to database.
//create unique image file name based on micro time and date $now = DateTime::createFromFormat('U.u', microtime(true)); $id = $now->format('YmdHisu'); // Path to move uploaded files $target_path = "uploads"; //the file name $path = "$target_path/$id.jpeg"; // getting server ip address $server_ip = gethostbyname(gethostname()); // final file url that is being uploaded $file_upload_url = 'http://'. $server_ip . '/' . 'abc' . '/' .$path;
What I expect for this code should generate the url in
json_encode as below:
But now the problem is it generate the Url but in
json_encode result is like below
What I tried so far,
$file_upload_url = 'http:'. $server_ip . 'abc' .$path;
But it not what I want,it become this
Can somebody have any idea how to solve this?Or have a better suggestion?