简体   繁体   English

文件路径返回无法加载资源:服务器响应状态为404(未找到)

[英]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.

相关问题 加载资源失败:服务器在 Heroku 上响应状态为 404(未找到)Laravel - Failed to load resource: the server responded with a status of 404 (Not Found) Laravel on Heroku Laravel | 加载资源失败:服务器响应状态为 404(未找到) - Laravel | Failed to load resource: the server responded with a status of 404 (Not Found) 加载资源失败:服务器响应,状态为404 Not Found - Failed to load resource: the server responded with a status of 404 Not Found Javascript XHR 向 php 文件发送请求:加载资源失败:服务器响应状态为 404(未找到) - Javascript XHR Post Request to php file: Failed to load resource: the server responded with a status of 404 (Not Found) Wordpress 无法加载样式:加载资源失败:服务器响应状态为 404(未找到) - Wordpress can't load styles: Failed to load resource: the server responded with a status of 404 (Not Found) 为什么Wordpress无法加载资源? 它说服务器响应状态为404(未找到) - why Wordpress failed to load the resource? It said that the server responded with a status of 404 (not Found) 出现错误说无法加载资源:服务器响应状态为404(未找到) - having an error says Failed to load resource: the server responded with a status of 404 (Not Found) 加载资源失败:服务器使用Js,ajax,php在联系表单上以404(未找到)状态进行响应 - Failed to load resource: the server responded with a status of 404 (Not Found) on contact form using Js, ajax, php 无法上传文件加载资源失败:服务器响应状态为503 - Cant upload file Failed to load resource: the server responded with a status of 503 我找不到图像(无法加载资源:服务器响应状态为403(禁止)) - i can not found image ( Failed to load resource: the server responded with a status of 403 (Forbidden) )
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM