扫描本地(用户)PC上的文件夹并将所有文件(图像)上传到网络服务器
我希望我的用户可以从他们的电脑中选择一个目录并上传该目录中的所有文件,这样他们就可以上传整个专辑(目录),而不是单独上传每个文件。 我想问您是否可以使用 PHP 或 JavaScript 并且不使用任何框架。 谢谢
I wish my users could select a directory from their PC and upload all files from this directory, so they could upload whole album(directory) instead of uploading every single file separately.
I would like to ask you if this is somehow possible using PHP or JavaScript and without using any framework.
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
首先,PHP不能对用户的本地计算机做任何事情。 因为它永远不会在那里运行(除非用户的计算机也是服务器)。
JavaScript 在用户的本地计算机上运行,但未设置为处理此类事情。
Java 和 Flash 在用户的计算机上运行,并且可以进行设置来执行此操作。
查看 SWFUpload。 我强烈推荐它。
如果您需要 Java,请查看 RadUpload。 精简版是免费的。
需要注意的是,这些 Flash 和 Java 解决方案的作用都是接受用户的文件选择,然后将其发送到执行实际上传的 PHP 脚本。
First of all, PHP can't do anything to the user's local computer. Since it never runs there (unless the user's computer is the server also).
JavaScript runs on the user's local computer but isn't setup to handle things like this.
Java and Flash runs on the user's computer and can be setup to do exactly this.
Look at SWFUpload. I highly recommend it.
And if you want Java, check out RadUpload. The lite edition is free.
A thing to note, what these Flash and Java solutions both do is accept a file selection from the user and then send that to a PHP script which does the actual uploading.
对于他们来说,上传包含多个图像的 .zip 可能更有意义 - 这在 PHP 中是可能的。
It would probably make more sense for them to upload a .zip containing multiple images - which is possible in PHP.
我认为按照你的描述这是不可能的。 创建一个小型实用程序,让他们可以在自己的 PC 上运行来完成这项工作。 另请查看 Facebook 上传图片的工作原理。 他们同时上传数十张图像。
I do not think it is possible as you describe it. Create a small utility which they can run on their PC that will do the job. Also check out how Facebook upload image works. They upload dozens of images at the same time.
纯粹使用 php/javascript 是不可能的。 但是,请查看 http://www.element-it.com/JavaPowUpload.aspx< /a>,它是一个基于java的文件上传器,允许您完全隐藏界面,并且,如果您愿意,可以通过javascript为整个界面提供支持。 然而,它不是免费的,也许不适合个人项目。
Not possible using purely php/javascript. However, take a look at http://www.element-it.com/JavaPowUpload.aspx, it is a java-based file uploader that allows you to completely hide the interface, and, if you wish, power the whole interface via javascript. However, it is not free, perhaps not suitable for a personal project.
这可能无法满足您对 Javascript 的要求,但如果您希望可以将上传器对象构建为 activex 对象,并使用 CURL 实际执行上传或将其作为 Java 小程序执行。
我为客户构建了一个基于 Java 小程序的上传器,我在网上找到了资源,并将其用作构建上传器的基础。
SWFUpload,正如您收到的答案之一中提到的,这是一个很好的答案。
This may not meet your requirement of Javascript, but if you wish you could build your uploader object as an activex object and use CURL to actually perform the upload or do it as a Java applet.
I had built a Java applet based uploader for a client and I found resources on line and used that as my base for building the uploader.
SWFUpload, as mentioned in one of the answers you received is a good one.