How can I upload an image from a desktop application to a remote database?

 Hi experts,

  I need to send an image from my client application to a remote database (The database is behind of a firewall).
  Which is the best way ?
  + 200 points to a answer with a source code
  + 400 points to a answer with a source code with thread example.

Who is Participating?
loop_untilConnect With a Mentor Commented:
I'm about to go out for today so you'll have to wait this evening for the threaded sources but you'll need a component that can work in thread and your web server will need to have the script/cgi timeout greater than what it takes to upload your biggest image if you want this. Normally, if you have those two things you will be able to send your pictures your way.

See you later! :-)

You'll have to provide more information.

 - What database (SQL Server, Oracle, mySQL, ...)?
 - What ports are blocked by your firewall -- or is the database port opened?

Your database being behind a firewall does complexify the problem. Most of the time, direct access to remote database server is not that secure and is restricted by the routers/firewalls. Sending the image to the database is not difficult in most of the cases nor is it to do it in a threaded way. Difficulty is that, if you don't have access to the database, well...

I can make you a threathed sample with source for mySQL quickly if you need so but I'll need more info about your firewall. By the way, you're better not posting the address of your server here if you give info about your firewall.

You should also think about sending the file by FTP and posting the path to the image in your database. Do you absolutely need to post the image directly to the database (this is not necessarily wrong but is it what you want)?

Have a nice day! :)
faustomenAuthor Commented:
My database is Firebird.

I have a Web Server connected to a database. When I need to put some data into database, I develop a cgi application. The application receive data from a client application and put this data into database.
Can I use this method to put an image into database?
I known to make this with text data. How can I make with image ? Can you send me an example ?

You can send me your threathed sample with source. I need this because my client application is freezing during the 'upload data' routine.


Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

faustomenAuthor Commented:
Ok. The pictures are small (maximum 200Kb).
I'll wait for your codes.

This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
       to delete this question and NOT refund points
Please leave any comments here within the next seven days.


Merry Christmas and happy new year!

EE Cleanup Volunteer
All Courses

From novice to tech pro — start learning today.