storing filename in field (rarther than path)

mikebaldam

Registered User.
Local time
Today, 16:21
Joined
Oct 29, 2002
Messages
114
Hi,

I've got a VB script to upload pictuires from a PC to my server,

I want to log the file name of pic im uploading in a field.

Currently the script I'm working off is giving me the path and name....

Private Sub cmdSelect_Click()
Me.CommonDialog3.initdir = "C:\images" ' This Directory can be set to any directory
Me.CommonDialog3.showopen ' Opens the Select File Dialog Box
Me.txtPath = CommonDialog3.filename ' Sends Filename to text box in Form

End Sub


Any idea's anyone...?

PS if someone is looking for a sample copy of file transfer see the attachment...

Cheers
 

Attachments

Try this...

Code:
Public Function ParseFileName(sFile As String) As String
On Error GoTo Err_ParseFileName

    Dim sPath As String
    
    sPath = sFile
    
    Do While Right$(sPath, 1) <> "\"
    sPath = Left$(sPath, Len(sPath) - 1)
    Loop
    
    ParseFileName = Mid$(sFile, Len(sPath) + 1)
 
Exit_ParseFileName:
    Exit Function

Err_ParseFileName:
    MsgBox Err.Number & " -" & Err.Description
    Resume Exit_ParseFileName
 
End Function
 

Users who are viewing this thread

Back
Top Bottom