mysql - Cant upload .csv file into db using php? -


Here is the code, which is written to upload the .csv file using php. But I get an error

  WARNING: fopen (excel /) [function.fopen]: failed to open the stream: there is no such file or directory in C: \ xampp \ htdocs \ interfaceas / Dealer_portal \ upload \ index.php on line 49  

which is the line

  if (($ handle = fopen ("excel /... FileName, "R"))! == Incorrect?  

Anyone may have gone wrong but someone can help here.

  _ Files ['csvfile'] ['name']! = "") {$ FileName = uploadFile ($ _ files ['excel file'], array (".csv"), "excel file"); $ line = 0 ; If (($ $ = $ fgeten ("$ data = fgetcsv ($ handle, 1000,", ")") = = FALSE (= $ handle = fopen ("excel / .. filename," r "))! { $ Num = Count ($ data); print_r ($ data); $ Query = "Dealer_Table (include title, first name, last name, email, phone) values ​​('.' $ Data [0]. '', '' $ Data [1]. "$ Data [.. 2]" ',' "$ data [3]" ',' "$ data [4]" ') "... mysql_query ($ Query);} Fclose ($ handle);}}  

you

  is a folder named C: \ xampp \ htdocs \ interfaceaseller \ dealer_portal \ upload \ excel  

and of course you are there A file is required

and what is also important in your line ...

  if (($ handle = fopen ("excel / .. Filename, "r")))! == incorrect)  

more errors

  if ($ _ files ['csvFile'] ['name']! = "") {// ___ ^^^^^^^^ _____ Here you have csvFile $ fileName = uploadFile ( $ _ Files ['excelFile'], array ("csv."), "Excel_file"); // ____________________________ ^ ^^^^^^^^^^ ____ Here you have an Excel file  

You should upload your script to try to increase it.)

  if ($ _ files ['csvfile'] ['tmp_name']! = "") Move_uploaded_file ($ _ FILES ['csvfile'] ['tmp_name'], "Excel / MyFile CSV") ;  

Comments