Solved

How to upload an image file from my computer to my server using Visual Basic 6?

Posted on 2013-01-25
5
300 Views
Last Modified: 2013-01-28
Hi guys,

I'm developing an app in vb6 that will contain Contacts but also the pictures of the persons, so i' thinking to create a folder on the network to contains all the pics, so my mySQL database won't contains them.

I already show the picture of the person on the form and i have a text box containing the path of the file, What I need now is to save, upload or copy the picture on the network folder.

This is the code to show the pic:

Private Sub cmdFoto_Click()
    CommonDialog1.ShowOpen
    txtBuscaFoto.Text = CommonDialog1.FileName
    Image1.Picture = LoadPicture(txtBuscaFoto.Text)
End Sub


Please any help!!!

Thank you guys.
0
Comment
Question by:elm9999
  • 2
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
Element1910 earned 500 total points
Comment Utility
Try either of these methods:
FileSystemObject.CopyFile "c:\PeopleImages\first_last.jpg", "\\server\sharename\"

Open in new window


Set oFSO = CreateObject("Scripting.FileSystemObject")
 oFSO.GetFile("c:\PeopleImages\first_last.jpg").Copy "\\server\sharename\", True

Open in new window

0
 
LVL 32

Expert Comment

by:Robberbaron (robr)
Comment Utility
have you explored saving the image as a blob in MySQL ? would make moving your app at a later date much easier and keep all the data together.
complete with Vb.net example that could be converted to VB6....
http://dev.mysql.com/doc/refman/5.5/en/connector-net-programming-blob.html


http://forums.mysql.com/read.php?20,17671,27914


Tip: To be able to insert images that are bigger than 1MB you have to increase the max_allowed_packed option in the server configuration file. You can change that in the Startup Variables section in the MySQL Administrator on the Networking page.
0
 

Author Comment

by:elm9999
Comment Utility
Thank you so much guys,

I think the best way to save the pics in on the server, Thank you Rob.
0
 

Author Comment

by:elm9999
Comment Utility
Thnak you so much element, it works great!!!
0
 
LVL 7

Expert Comment

by:Element1910
Comment Utility
You're welcome! :) Glad I could help!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now