0

i am successful to import data from my local pc but the problem is,it is not working on the server here is the code that works fine when i load the file from pc directory

LOAD DATA LOCAL INFILE 'C:/test.txt' INTO TABLE pet fields terminated by ',';

but it doesn't work when i put server location like

LOAD DATA LOCAL INFILE 'http://localhost/farzana/erp_fiat/files/test.text' INTO TABLE pet fields terminated by ',';

it will be very helpful if someone fix this problem

Rahat Islam Khan
  • 125
  • 1
  • 6
  • 25

3 Answers3

1

Remove LOCAL if you are loading it from server.

LOAD DATA INFILE 'http://localhost/farzana/erp_fiat/files/test.txt' INTO TABLE pet fields terminated by ',';
uhs
  • 838
  • 1
  • 7
  • 21
1

replace test.text with test.txt in the url and paste the URL in the browser if you can see the file,

else use the absolute path of the directory, instead of the URL

Archer
  • 1,152
  • 4
  • 12
  • 34
  • how will i use absolute path when i upload it to the remote server..? – Rahat Islam Khan Jan 21 '14 at 07:24
  • check the output of `echo $_SERVER['DOCUMENT_ROOT'];`, try usign this , it should be your path to the application, then you can add your file location from there. – Archer Jan 21 '14 at 07:49
0

According to this answer:

When you do a LOAD DATA INFILE, the file must be on the system that is running the MySQL database, in the data path.

If the file is on your system, add the LOCAL keyword.

Try to remove the LOCAL key word.

Community
  • 1
  • 1
Renier
  • 1,523
  • 4
  • 32
  • 60