PHP CSV上传文件 [英] PHP CSV upload files

查看:100
本文介绍了PHP CSV上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我提出了有关将csv文件内容更新到数据库的问题此处

I have asked a question regarding updating a csv file's contents to the db here.

现在我想添加这个功能,像我的db将包含存储在服务器上预先指定的文件夹中的图像的URL。

Now I want to add this functionality, like my db will contain url to images that are stored in a pre-specified folder on the server.

csv文件将包含这些图像驻留在客户端上的位置的网址。
现在当我点击上传时,应该会发生以下情况:

The csv files will contain the urls as to where these images reside on the client side. Now when I click an upload the following should happen


  1. 我的文件必须读取客户端上的图像位置

  2. 必须将图片从客户端复制到服务器的预先指定的文件夹

  3. 使用图片的网址更新数据库表中的相应字段

  1. My file must read the location of image on the client side
  2. Must copy the image from the client to the server's pre-specified folder
  3. update the corresponding field in the db table with the url of the image


推荐答案

您无法使用PHP访问客户端。甚至没有使用Javascript或Flash(我相信)。至少不是没有某种服务器在客户端上运行,但是这将是非常愚蠢的。

You cannot access the client with PHP. Not even with Javascript or Flash(i believe). At least not without some sort of server running on the client, but that would be quite stupid.

如果你只是想要上传图像到服务器,并让任何客户端做这个(至少几乎任何),有一堆免费和付费的软件使用智能方法来完成这一点。例如,请查看 Uploadify

If you simply want to upload images to the server, and let any client do this(at least almost any), there are a bunch of free and payed software using smart ways to accomplish this. Take a look at Uploadify for instance.

这不回答你的问题,因此如何从csv文件中读取数据, str_getcsv 应该做的。

This doesn't answer your question, so as how to read data from an csv-file, the str_getcsv should do the trick.

这篇关于PHP CSV上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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