Answer the question
In order to leave comments, you need to log in
How to rewrite this code from PHP to Node JS?
<?php
$st = new Memcache;
$st->connect('127.0.0.1', 11033);
$file = "/var/www/files/base/2048.png"; // полный путь к локальному файлу
$ext = pathinfo($file, PATHINFO_EXTENSION);
$volume_id = 1000;
$ret = $st->get("file{$volume_id},{$file}");
if ($ret !== false) {
list($secret, $local_id) = explode (",", $ret);
$link = "http://vk.com/v{$volume_id}/{$local_id}/{$secret}.{$ext}";
} else
die('upload error');
?>
<a target="_blank" href="<?=$link?>"><?=$link?></a>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question