ftp - PHP web file manager -
im having troubles load images web file manager php page. have in page:
<?php define("ftp_connect_ip", ip); define("ftp_connect_port", port); // set username , password define("ftp_login_user", username); define("ftp_login_pass", pw); // connect ftp server $conn = ftp_connect(ftp_connect_ip, ftp_connect_port); // log ftp srever $login_result = ftp_login($conn, ftp_login_user, ftp_login_pass); if(ftp_pasv( $conn, true )){ echo 'works'; }else{ { echo 'dont works'; } } ftp_close($conn); ?>
the problem is, have no clue how directly access files nas (web file manager). can list of files in directory specify, have no idea how load them, , if direct file access alowed done. appreciated, since lack knowledge kind of things.
if(ftp_pasv( $conn, true )){ $contents = ftp_nlist($conn, '/');
try adding line above in place of echo 'works';
line, check var_dump($contents);
shows.
to print image in php, let's have file path stored variable. define variables this:
$imageurl = '/home/user/domain/assets/img/123.png';
although can way you've done above:
define("/home/user/domain/assets/img/123.png", imgurl);
when you've got url defined, have use html print image.
an example of either of following:
echo "<img src=\"".$imageurl."\"/>";
the above same echo "<img src=$imageurl />";
, written validation , escaped quotes.
or perhaps more simply, closing php tag , opening url.
?> <img src="<? echo $imageurl; ?>" /> <?
both of these use html, markup language display things on webpages.
edit: although not recommended, , not safe, viable solution actual problem here include ftp path in img tag follows.
<img src="ftp://user:password@domain.com:port" />
please make separate user purpose read access folder.
Comments
Post a Comment