2018-11-08 13:02
浏览 247

临时文件不会出现在xampp / tmp中

I'm uploading a csv file to my php server with this form:

<form action="importCSV.php" method="post" enctype="multipart/form-data">
            <br>Select file: <input type="file" name="file">
            <br><input type="submit" name="import" value="Import file">

And what I want to do with that file is to add its content to a table in my mysql server.

$con = new mysqli(HOST, US, PW, BBDD);
$sql="load data local infile '" . $url. " into table users fields terminated by ':'";

The problem is that in the "tmp" folder of the php server doesn't appear the csv file, but in this line $url=$_FILES['file']['tmp_name'] $url has a real url with a tmp_name. I don't understand what's happening there: I have the url with the tmp_name of the file but it actually doesn't exists?

I have checked the php.ini file and this are the values for the file uploads:


I'm not worried about the "upload_max_filesize", the file I'm trying to upload has a size of only 56 bytes.

Please, any ideas?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongtao6842 2018-11-08 13:19

    I can't believe this... It seems that the mysql server doesn't understand this character \. It's only a problem of compatibility between operative systems.

    The solution is only to replace the character: $url= str_replace("\\", "/", $url).

    打赏 评论

相关推荐 更多相似问题