从服务器获取文件的路径 [英] get path of file from server

查看:136
本文介绍了从服务器获取文件的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的测试代码:

i只需创建一个文本文件并存储在服务器文件夹名称image.it存储在文件夹中

但是当我尝试阅读时或检查使用网址,但文件不存在从条件返回。

所有权限都设置为读取和写入图像文件夹

所以请解决我的问题。



here is my test code:
i just create a text file and store on server folder name"image".it stored on folder
but when i try to read or check using url but file not exist return from if condition.
all the permission are set to read and write of image folder
so please solve my problem.

<?php

        $FileName="/home/a/public_html/image/"."image_".rand().".txt";
    $binary="hello";
    $Event_file = fopen($FileName, "wb");
    fwrite($Event_file, $binary);
    fclose($Event_file);
    $Path=realpath($FileName);
        echo "path".$Path."<br>";
 //get image file
    $get_path="http://www.myapp.net/image/image_654391973.txt";
echo $get_path ."<br>";
   if(is_file($get_path))
{
echo "file exists on server";
}
else
{
echo "file not exists on server ";
}
?>

推荐答案

FileName = / home / a / public_html / image / image _ .rand()。 .txt;
FileName="/home/a/public_html/image/"."image_".rand().".txt";


binary = hello ;
binary="hello";


Event_file = fopen(
Event_file = fopen(


这篇关于从服务器获取文件的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆