从本地系统检索图像文件 [英] Retrieve image files from local system

查看:88
本文介绍了从本地系统检索图像文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从本地系统的我的图片文件夹中检索图像文件并显示这些图像?

How can i retrieve image files from a local system''s My pictures folder and display those images?

推荐答案

JavaScript不允许访问本地文件系统,所以只要将图像的src设置为本地文件路径,这是不可能的。


你可以做的是使用输入文件元素并上传文件到服务器然后显示它。
JavaScript doesn''t allow access to the local file system, so this isn''t really possible by just setting the src of images to the local filepath.

What you can do is use an input file element and upload the file to the server and then display it.


为此,你必须在服务器端制作一个管理当前文件夹路径的功能


并调用该函数来自img按钮的内联..

for that, u have to make one function on server side which manage current folder path

and called that function from inline on that img button..

展开 | 选择 | Wrap | 行号


as acoder已经说过了:javascript不允许访问客户端的本地文件系统......它不应该! ...想象一个可以访问你的文件系统的网页......没人想要。当然,您可以在可以控制此类事物的环境中使用某些权限或安全设置(本地计算机或内部网)...但在公共站点上,您无法控制用户设置...

亲切的问候
as acoder said already: javascript doesn''t allow access to the local filesystem of the client ... and it should NOT! ... imagine a webpage that could access your filesystem ... nobody wants that. of course you could use some privileges or security settings in an environment where you could control such things (local machine or an intranet) ... but on a public site you cannot control the users settings ...

kind regards


这篇关于从本地系统检索图像文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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