Jump to content

help needed in CSV file loading


mgn

Recommended Posts

My code, is to get data from a CSV file and place it in MYSQL DB.
This works perfectly in local server.

When iam  trying  to setup my webpage, which  i tried to perform same task is to load
that csv file's data into mysql table,but it won't work!! don't know why!!

The error  says "No such file or directory"
[code]
if ( $_REQUEST['readhid'] != "")
{

$path = htmlentities($_POST['file']);
$date = htmlentities($_POST['date']);
   
  $filename = basename($path);     
  $fd = fopen ($filename, "r");
$contents = fread ($fd,filesize ($filename));
fclose ($fd);

..........................
...............
...........//and code is going on
                  //Error "No such file  or directory".
                //But it perfectly works when tested with localserver.
}

<form  name = "frm" action = "readchk01.php" method ="post">
<table border="0" width="100%" id="table1">
<tr><td>
Enter filename:  <input type = "file" name = "file" /> </td></tr>
<tr><td>
  Enter date:  <input type = "text" name = "date"  size = 20 value = ""/></td></tr>
<input type = "submit" name = "sbt" value = "upload" onClick="return validate();" />
</td>
</tr>
<input type="hidden" name="readhid" value="read">
</table>
</form>


[/code]
Link to comment
https://forums.phpfreaks.com/topic/36170-help-needed-in-csv-file-loading/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.