Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa PHP PHP code for csv file upload into mysql
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


raja
PHP code for csv file upload into mysql
1 Answer(s)      3 years ago
Posted in : PHP


I want to upload a file from my pc to mysql server using upload option. while i m selecting the csv file it ll be upload the mysql database. can u send me the coding? i have tried the following coding. it is not working properly. pls help me,

Regards, Raja V, ISB


Advertisement
View Answers

November 9, 2011 at 12:09 PM


1) uploadForm.html:

<form method="post" enctype="multipart/form-data" action="upload.php">
<table width="350" border="0" cellpadding="1" cellspacing="1" class="box">
<tr>
<td width="246">
<input type="hidden" name="MAX_FILE_SIZE" value="2000000">
<input name="userfile" type="file" id="userfile">
</td>
<td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td>
</tr>
</table>
</form>

2) upload.php:

<?php
if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0)
{
$fileName = $_FILES['userfile']['name'];
$tmpName  = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];

$fp      = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);

if(!get_magic_quotes_gpc())
{
    $fileName = addslashes($fileName);
}

include 'library/config.php';
include 'library/opendb.php';

$query = "INSERT INTO upload (name, size, type, content ) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$content')";

mysql_query($query) or die('Error, query failed');
include 'library/closedb.php';

echo "<br>File $fileName uploaded<br>";
}
?>


Related Tutorials/Questions & Answers:
PHP code for csv file upload into mysql
PHP code for csv file upload into mysql  I want to upload a file from my pc to mysql server using upload option. while i m selecting the csv file it ll be upload the mysql database. can u send me the coding? i have tried
php csv file uploding into mysql database table.
php csv file uploding into mysql database table.  hai friends, i... fields. i have one mysql database table with two files fields, when ever i am uploding csv file, i want to fetch the datas in corresponding fields in table. can
Advertisements
upload csv to mysql db using jsp upload
upload csv to mysql db using jsp upload  Hello all, Please give me the code to uplad .csv from jsp page and insert values into MySQl db. I have a table with 8 cloumns.(MDN--varchar(30),Otafdate date,crt varchar(30),dmdn
java, upload csv file - Development process
java, upload csv file  hi, i have a csv file having 29 colums, i want to upload that csv file to database. i need the code,, can u please send me the code.. thanks..  Hi Friend, Please visit the following
Upload CSV File into Columns of sql table using servlets and jsp
Upload CSV File into Columns of sql table using servlets and jsp  Hello sir, plz give me the code to upload csv file data into respective columns of table
To Upload and insert the CSV file into Database
To Upload and insert the CSV file into Database... to upload a CSV file through JSP and insert it into the database. For this, we have...;TITLE>Display file upload form to the user</TITLE></HEAD> 
Exporting data from mysql to csv file
Exporting data from mysql to csv file  Hi friends.... I want to export the data from mysql to csv file... i am having 30 columns in my database.. Eg- text1,text2,text3,....,upto text30... i want to export this data in csv file
zip file upload in php - WebSevices
zip file upload in php  This is not a normal upload. we know the code for normal upload. i need the zip file upload code in php. how to upload zipfile using php? and how to unzip using php? please i dont
create csv file in php in multiple columns
create csv file in php in multiple columns  i need create csv file in multiple columns like this: id name age date_added 1 john 23 2012-2-12 2 jane 25 2012-3-14 i can build csv file like this: id,name,age,date
create csv file in php in multiple columns
create csv file in php in multiple columns  i need create csv file in multiple columns like this: id name age date_added 1 john 23 2012-2-12 2 jane 25 2012-3-14 i can build csv file like this: id,name,age,date
Multiple File Upload in PHP
Multiple File Upload in PHP  Hi, I am beginner in PHP scripting language. I am very interested to learn PHP application. So, can anyone explain or provide related reference about how to Multiple file upload in PHP. Thanks
upload a file into database and progrm should support excel and text and csv file formats
upload a file into database and progrm should support excel and text and csv file formats  Hai all, I need a program to upload a file into database table... and the program should support .excel ,.txt ,.csv file formats. can
phpmyadmin - upload csv files - SQL
phpmyadmin - upload csv files  i have database in phpmyadmin. i have upload one time in csv file. i need to another csv file in upload same table. i will try to do this but result is failed. (table rows and csv rows are same
create dropdown cell in csv or excell from mysql data in php
create dropdown cell in csv or excell from mysql data in php  Hello sir i want to create drodown cell in csv from mysql data is this is possible or not? if this is posible please share answer or reference link Thanks
Mysql-Php code
Mysql-Php code  I want to mysql script for query data from two tables in the mysql database trough php code. Can you help me   Hi Friend, Please visit the following link: Php Mysql Thanks   Hi Friend
sir, how to convert excel file to csv file using java? please send me sample code.
sir, how to convert excel file to csv file using java? please send me sample code.  please send me sample code for converting excel file into csv file uisng java
How to Increase Upload File Size Limit in php
. But the default file upload size settings restrict you to upload large files. PHP... can also check it: http://www.phpzag.com/php-increase-upload-file-size-limit...How to Increase Upload File Size Limit in php  Increase Upload File
csv file download
csv file download  Hello Every one, when user clicks download button I want to retrieve data from mysql database table in csv format using java.if you know please send code. Thanks in Advance   Please visit
Import MYSQL file in PHP - PHP
Import MYSQL file in PHP  i wanted to import the mysql file in PHP5 on button click. is it possible to do it? Is there any possibility of data security
php download file code
php download file code  PHP code to download the files from the remote server
Upload csv or .xlsx file from JSP form to Database Table using servlet
Upload csv or .xlsx file from JSP form to Database Table using servlet  dear sir, i need the Servlet code that reads the .xlsx or CSV excel file... to Submit My Project i am using following code which is Working for .xls Excel file
Import Excel file(date) into mysql database in php
Import Excel file(date) into mysql database in php  I try to import excel file which contains data date(yyyy-mm-dd) into mysql database in php. But it not insert the data in mysql. Code $fp = fopen("data.csv",'w'); fwrite
java code to upload and download a file - Java Beginners
java code to upload and download a file  Is their any java code to upload a file and download a file from databse, My requirement is how can i... hos a.doc  Hi friend, For more information on File Upload
code to upload and download a file - Java Magazine
code to upload and download a file  Is their any code to upload a file and download a file from databse, My requirement is how can i store two... user send one a.doc file to x ,he has to download his a.doc another user sends
Struts(1.3) action code for file upload
Struts(1.3) action code for file upload  Hi All, I want to upload file using struts framework. the request should be came from standalone application using HttpUrlConnection. How can i write my struts(1.3) action code
upload video using php
upload video using php  How to upload a video on MYSQL Server using PHP Code..? Can any one provide me an example
.csv file to databse
.csv file to databse  I have an 1 .csv file.. its having the url values like http://maps.google.com/?q=425+Bingeman+Centre+Drive%2c+chrompet%2c+ON%2c+600+006... q is request parameter .425 Bingeman Centre Drive is address
File Upload
File Upload  when i execute the image upload to mysql database it shows an exception that file path cannot be found
How to write into CSV file in Java
How to write into CSV file in Java  How to write into CSV file in Java   Hi, To create Comma separated value(CSV) file is very simple and the CSV file stores the value in the tabular form i.e. rows and columns
Exporting data from mysql into csv using jsp
Exporting data from mysql into csv using jsp  Hi friends.... I want to export the data from mysql to csv file using... i am having 30 columns in my... in csv file..if i export, am getting the csv file with all data in one row
how to convert .xml file to csv file
how to convert .xml file to csv file  how to convert .xml file to csv file
Advertisements
 

 

 

DMCA.com