The sql query is sound. The tmp_file is created correctly and can be viewed 
live. It just does't hit the database.  :(

-----Original Message-----
From: tamouse mailing lists [] 
Sent: Thursday, July 26, 2012 5:52 AM
To: Brad
Subject: Re: [PHP-DB] No data?

In reading over LOAD DATA ... in the mysql reference. it makes particular note 
of the fact that the file it's reading must be completely world readable, 
including all paths to the file. In checking just now, I notice that a file 
uploaded by php and placed in /tmp is only readable by the server user (aka, 
www-data on some systems).

   "For security reasons, when reading text files located on the server, the 
files must either reside in the database directory or be readable by all."

This tiny script shows what happens:

<html><head><title>file upload example</title> <meta http-equiv="Content-Type" 
content="text/html; charset=UTF-8" /> </head> <body> <h1>file upload 

  <?php var_dump($_FILES); ?>

   if (count($_FILES)>0) {
     $lscmd = 'ls -l '.$_FILES['userfile']['tmp_name'];
     echo '<h2>ls -l tmp_name</h2>'.PHP_EOL;
     echo '<pre>'.`$lscmd`.'</pre>'.PHP_EOL;

<form enctype="multipart/form-data" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
    Send this file: <input name="userfile" type="file" />
    <input type="submit" value="Send File" /> </form>


When a file is submitted, this is the output:

file upload example

  array(1) {
  array(5) {
    string(15) "testfile.txt"
    string(10) "text/plain"
    string(14) "/tmp/phphxGoQm"

ls -l tmp_name

-rw------- 1 www-data www-data 4244 Jul 26 04:41 /tmp/phphxGoQm

Send this file: <form stuff shows up here>

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to