Jump to content

having problem with "LOAD_FILE("...")" c


Recommended Posts

The problem is as follows :

 

How to get the LOAD_FILE() command to work in a .php script?

 

I have tested the command itself in mySQL and it works fine. (I am trying to import a .txt file into one field of a table)

I have used the command as follows :

 

INSERT INTO common VALUES

(1, 1, LOAD_FILE(\"e:\\1.txt\"), NULL, \'N\');

and it worked the way i wanted it - so there can\'t be any problems with the database itself.

 

Then I tried to use the same command in a php script :

 

$address = \"e:\\\\1.txt\";

$load_file = \"INSERT INTO common VALUES

(\'$row[$x]\',$user\',LOAD_FILE(\"$address\"),\'NULL\',\'N\')\";

$result = mysql_query($load_file);

 

then the page containing the script reloads for quite a long time, and when I check mySQL what actually happened I get the output :

 

1,1,NULL,NULL,N

 

WHAT\'S WRONG WITH THE SCRIPT???

the command in mySQL imports the data correctly, the script fails to do so.

HEEEEEELP!!!!

Link to comment
https://forums.phpfreaks.com/topic/328-having-problem-with-load_file-c/
Share on other sites

Okay ... the thing seems to work now.

 

The problem seems to be too long file names!

 

I was using names like \"keywords_182398741.txt\"

when I changed the name to \"1.txt\" it worked all right!

 

 

 

 

Is there any limit to how long a file name can be (for mySQL to handle) ?

wraith

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.