Want to be able to insert images into form. Images to be saved on drive.

moto485

Registered User.
Local time
Today, 00:40
Joined
Oct 18, 2011
Messages
50
Basically I am looking at the best way for the user to be able to browse for a image on their computer and then insert it (copy it to a folder on the local server), save its location in the database.

I figure this is the best way as images are not great in databases but I have no idea how to do this... Can anyone point me in the right direction?
Thanks.
 
well,

what have you tried already that doesnt work? In order to insert something onto a 'designed' form, you would need a container. here is what i would probably do

on the form, have an image control and call it imgPicture

get some code to allow you to browse for an image. this would get the path of the file that you want to show on the form

once you have the file path, you can use something like-
Code:
'where mypath is the returned path from the browse box
Me.imgPicture.Picture = MyPath
Me.Requery

once you are this far, you then have to variables set to copy the image to the folder.

There is a function that allows you to copy from place to another. look for the function and use it to-

get the file from the path you returned frrom the browse folder
Put the file in the location where you want it.

You could use a second browse box or have a pre determined location. Lets go on the basis of a browse box. You already have the returned path from the image you placed on the form, i would set a variable to hold the path
Code:
Dim sGetPicture As String
i would then have a second variable to save the path of the location thatimage needs to go to
Code:
Dim sPutPicture As String

Now you have these variables, you can pass them to the function that copies the file. Whe nthe copy is complete, you can update a record and place the image path from sPutPicture to it so you have a record of the image path.

If you show what you have already tried or post a b sample, i'll help you a long a bit.


cheers

Nidge
 
Hey Nigel I never said thanks for that info it was just what I needed :)

Thanks!
 
Hi,

Not sure you got everything working but I've upload something that I use with all the code in place. You'll need to open the Employee form and add the picture from your computer to work.
 

Attachments

quick note you'll need to add a reference to the Microsoft Office 12.0 Object library for the action to work.
 
Thanks for that.

I was able to get everything done thanks to Nigel's rundown on what to do. I am about a week away from doing the same thing as I have done locally but this time FTP for the images, files and MYSQL for the database. If you have any insight into that I would greatly appreciate it. I am confident with MYSQL it is just the FTP side of things I am going to have to research.
 
Hi Moto

you need tolook into InternetOpen functions for ftp. I think i have an ftp model from ages ago becuase at the time, i was looking to work with application updates.

if i find it, i'll post it. AJTrumpet posted an ftp sample on here too ;)


cheers

Nidge
 
Thanks Nigel I'm going to look into it looks like I got a lot of learning to do here
 

Users who are viewing this thread

Back
Top Bottom