[英]file path returning Failed to load resource: the server responded with a status of 404 (Not Found)
I am getting this error message 我收到此错误消息
Failed to load resource: the server responded with a status of 404 (Not Found)
无法加载资源:服务器响应状态为404(未找到)
I have a file class_start_paperwork.php
file that is in the include folder creates pdfs and jpgs to the private folder 我有一个文件
class_start_paperwork.php
文件,在include文件夹中创建pdfs和jpgs到私人文件夹
so 所以
I am trying to show the image in the user_group_start_paperwork_esign2.php
file which is in the public_html folder 我试图在
user_group_start_paperwork_esign2.php
文件中显示图像,该文件位于public_html文件夹中
"/root
/private
/scratch
/1387.2742.1487969899-0.jpg"
"/public_html
/include
/class_start_paperwork
/user_group_start_paperwork_esign2.php"
it is creating the images 它正在创建图像
I just can't load the jpgs 我只是无法加载jpgs
<img src= '../private/scratch/1387.2742.1487969899.0.jpg' width=800 height=1100 />
is what is in the page source is 是页面源中的内容
It seems like the /private folder is outside the public world zone. 好像/ private文件夹在公共世界区域之外。 You would have to move the contents of /private folder into the public zone and relink for the web browser to be able to access.
您必须将/ private文件夹的内容移动到公共区域并重新链接以使Web浏览器能够访问。
If you would be displaying the images using server side language, that would be a possibility with the correct permissions. 如果您要使用服务器端语言显示图像,则可能具有正确的权限。
This answer has some good info: Display images from private directory 这个答案有一些很好的信息: 从私人目录显示图像
Ideally you'd just make that directory accessible, but if that's absolutely not possible then you can do this:
理想情况下,您只需要访问该目录,但如果这绝对不可能,那么您可以这样做:
myimage.php
myimage.php
$file = 'privatedir/image.jpg';
$ file ='privatedir / image.jpg'; $type = 'image/jpeg';
$ type ='image / jpeg'; header('Content-Type:'.$type);
报头(“内容类型:” $型); header('Content-Length: ' . filesize($file));
header('Content-Length:'。filesize($ file)); readfile($file);
ReadFile的($文件); exit();
出口();
Then use myimage.php as the img tag src.
然后使用myimage.php作为img标签src。
this worked perfectly 这很完美
myimage.php myimage.php
$file = 'privatedir/image.jpg'; $ file ='privatedir / image.jpg'; $type = 'image/jpeg';
$ type ='image / jpeg'; header('Content-Type:'.$type);
报头(“内容类型:” $型); header('Content-Length: ' . filesize($file));
header('Content-Length:'。filesize($ file)); readfile($file);
ReadFile的($文件); exit();
出口();
Then use myimage.php as the img tag src. 然后使用myimage.php作为img标签src。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.