0

Save Image/File to database

asked 2015-07-14 03:50:22 +0800

bhapux gravatar image bhapux
1

How to save image/file to database sql server?
anyone have running project saving image to database like mysql?

delete flag offensive retag edit

5 Answers

Sort by » oldest newest most voted
0

answered 2015-07-14 06:47:33 +0800

Darksu gravatar image Darksu
1991 1 4

updated 2015-07-14 06:48:07 +0800

Hello bhapux,

In order to accomplish your task you have to:

  • Use Fileupload in order to let the user to upload the file to the server

http://books.zkoss.org/wiki/ZKDeveloper'sReference/UIPatterns/FileUploadandDownload

http://forum.zkoss.org/question/97558/fileupload-not-working/?answer=97561#post-id-97561

  • After uploaded, you will get a AMedia, use getByteData() to get the image binary data.
  • Save the data to the database preferably using Hibernate or plain jdbc

http://www.mkyong.com/hibernate/hibernate-save-image-into-database/

Best Regards,

Darksu

link publish delete flag offensive edit
0

answered 2015-08-05 09:07:10 +0800

bhapux gravatar image bhapux
1

dear darksu,

how to multi upload file? are you have an example?

link publish delete flag offensive edit
0

answered 2015-08-05 09:48:00 +0800

kopla gravatar image kopla
1
http://finanseblogowo.wor...

I need to know too! ;)

link publish delete flag offensive edit
0

answered 2015-08-05 09:57:46 +0800

Darksu gravatar image Darksu
1991 1 4

Hello bhapux,

A nice example on how to upload multiple files can be found at the following fiddle:

http://zkfiddle.org/sample/2kopnr6/5-Multi-file-upload#source-1

Use the example, and the info i provided above in order to accomplish your task.

Best Regards,

Darksu

link publish delete flag offensive edit
0

answered 2015-08-06 03:24:39 +0800

bhapux gravatar image bhapux
1

dear darksu,

mmm i have problem when i save it to database, can you give me example with database?

link publish delete flag offensive edit

Comments

There are two options to save image to database. First, save the image path only. Second, set the database column to blob type, then you can save image to database with byteArray data.

vincentjian ( 2015-08-06 03:40:35 +0800 )edit

i am using 2nd option, set database column to BLOB, and then how to save multiple file into db using method http://zkfiddle.org/sample/2kopnr6/5-Multi-file-upload#source-1 ?

bhapux ( 2015-08-06 04:08:08 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2015-07-14 03:50:22 +0800

Seen: 73 times

Last updated: Aug 06 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More