PHP CSV upload files

北战南征 提交于 2019-12-04 06:31:19

问题


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

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.

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. 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

回答1:


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.

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.

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



来源:https://stackoverflow.com/questions/2461090/php-csv-upload-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!