I am trying to upload a csv file to a website that was created using a MySQL query in a php file. Here is the code:
*************************************
// Fetch Record from Database
$output = "";
$table = "customer"; // Enter Your Table Name
$sql = mysql_query("select * from $table");
$columns_total = mysql_num_fields($sql);
// Get The Field Name
for ($i = 0; $i < $columns_total; $i++) {
$heading = mysql_field_name($sql, $i);
$output .= '"'.$heading.'",';
}
$output .="\n";
// Get Records from the table
while ($row = mysql_fetch_array($sql)) {
for ($i = 0; $i < $columns_total; $i++) {
$output .='"'.$row["$i"].'",';
}
$output .="\n";
}
// Download the file
$filename = "myFile.csv";
header('Content-type: application/csv');
header('Content-Disposition: attachment; filename='.$filename);
echo $output;
exit;
*****************************************
All this code is doing is displaying the results in the browser.
My problem is how do I get the myFile.csv uploaded to the following directory:
http://eztiffin.com/fileuploads/ I need to get the actual path from my hosting company
Any help would be appreciated. thanks
jpizzolato 0 Newbie Poster
jj.dcruz 0 Junior Poster
diafol
jpizzolato 0 Newbie Poster
gabrielcastillo 40 Web Developer
Mike_danvers 0 Junior Poster in Training
diafol
sikander123 0 Newbie Poster
diafol
sikander123 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.