473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Java mysql play framework about uploading file data to db

8
i think this is mysql question.correct me if its java!
I am using play framework (mvc java for web app).
my question is that i want to save data from (.txt) file to mysql. So i got upload.html :
Expand|Select|Wrap|Line Numbers
  1. <form action="mplapla" method="POST" enctype="multipart/form-data">
  2.    <input type="file" name="filename" />
  3.         <input type="submit" value="upload file"/>
  4. </form>
  5.  
and for the action i got
......
QUERY= "LOAD DATA INFILE '"+filename+"' INTO TABLE mytAble;";
......
which doesnt work.if i do
query = "LOAD DATA INFILE 'c://myfile.txt' INTO TABLE mytAble;";
works fine(puts the data of myfile to mysql table)
what can i do ? any help appricieted !!
Mar 23 '12 #1
1 2717
johny10151981
1,059 1GB
I hope there is a function available in your java api library

mysql_real_escape_string, use this function to filter your filename. and then do this
Expand|Select|Wrap|Line Numbers
  1. QUERY= "LOAD DATA INFILE '"+filename+"' INTO TABLE mytAble;";
Mar 30 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: francescomoi | last post by:
Hi. I'm trying to build 'MySQL-python-1.2.0' on my Linux FC2: ---------------------------------- # export PATH=$PATH:/usr/local/mysql/bin/ # export mysqlclient=mysqlclient_r # python setup.py...
6
by: jackson | last post by:
Hi all, Im having problem when uploading file to localhost. but I can upload to drive c: any idea thanks
3
by: Carlos | last post by:
Hello Forum, I would appreciate it if you could recommend settings to use auto-vacuum in my version 7.4 database. I am uploading several thousands records in the database at a rate of ~1 second...
0
by: Monica | last post by:
I have a problem with uploading file into SQL 2005 DB using IIS 6.0 webserver, this code was working in SQL 2000 Db and IIS 5.0. Can you please help me to see what the problem is. Error msg :...
0
by: Mika M | last post by:
Hi! I'm uploading file(s) over internet like... My.Computer.Network.UploadFile("C:\file1.txt", "ftp://some.domain.com/file1.txt", "MyUID", "MyPWD", False, 1000) ....and this is working...
3
by: detrox | last post by:
Hi, all I have two questions about uploading files using php & html: 1. How can i add a `file type' in the pop window when i click `browse' button of the `<input type=file>'. 2. How can i get...
4
by: I Hate My Computer | last post by:
Hi, I am looking to play a wave file in visual basic. I would like it to play from the resource file. I have added the wave file but how do I get it to play? I do have this code. Dim Sound As New...
6
by: homevista | last post by:
PART III: Putting things together In part I we examined the modem to verify that it supported voice. If so, we took a note about the voice data format that we would use. In the second part, we...
1
by: jimmylee | last post by:
Hi All, Please help me . I am getting aspSmartUploadfile error while uploading file I have already instrall aspSmartUpload.dll and aspSmartUploadutil.dll. how to solve this error. thanks....
4
by: ish | last post by:
hello everybody...... plz help me out... how we can store the acual path of uploading file.i want to store the path of file in my database...bt i m not getting anyway to implement that......if...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.