Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - submit file name in a form?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

submit file name in a form?

 Post Reply Post Reply
Author
zMaestro View Drop Down
Senior Member
Senior Member


Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
Post Options Post Options   Thanks (0) Thanks(0)   Quote zMaestro Quote  Post ReplyReply Direct Link To This Post Topic: submit file name in a form?
    Posted: 28 October 2003 at 1:53pm

sorry, i think this question was asked many times before, i want to just trim the name of the file from a form, i.e. when the user enters:
C:\Documents and Settings\ashrafvision\Desktop\5124.jpg
just the value 5124.jpg enter the database

how can i remove the C:\Documents and Settings\ashrafvision\Desktop\

sorry again, and thanks.

Back to Top
fernan82 View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
Post Options Post Options   Thanks (0) Thanks(0)   Quote fernan82 Quote  Post ReplyReply Direct Link To This Post Posted: 28 October 2003 at 2:56pm
There might be an easier way but something like this will do it:

Dim intPos
intPos = 1

Do While inStr(intPos, strFilename, "\", 1)
   intPos = inStr(intPos, strFilename, "\", 1) + 1
Loop

strFilename = Right(strFilename, Len(strFilename) - (intPos - 1))

Might have to do some tweaking to get it to work right but that's an idea...
FeRnAN
Back to Top
Flamewave View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 June 2002
Location: United States
Status: Offline
Points: 376
Post Options Post Options   Thanks (0) Thanks(0)   Quote Flamewave Quote  Post ReplyReply Direct Link To This Post Posted: 29 October 2003 at 10:10am

filename = StrReverse(filename)
filename = Left(filename, (Len(filename) - InStr(filename, "/"))
filename = StrReverse(filename)

something along those lines should work to. You may need to tweak it a bit as I didnt test it out to be sure it worked. You could also use a regular expression replace statement if you know enugh about regular expresions (I don't, otherwise I would have posted that).



Edited by Flamewave
- Flamewave

They say the grass is greener on the other side, but if you really think about it, the grass is greener on both sides.
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 29 October 2003 at 10:53am

One line of code:

fileName = Mid(fileName, InstrRev(fileName,"\")+1)

 

Contribute to the working anarchy we fondly call the Internet
Back to Top
zMaestro View Drop Down
Senior Member
Senior Member


Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
Post Options Post Options   Thanks (0) Thanks(0)   Quote zMaestro Quote  Post ReplyReply Direct Link To This Post Posted: 29 October 2003 at 11:58am
Originally posted by MorningZ MorningZ wrote:

One line of code:

fileName = Mid(fileName, InstrRev(fileName,"\")+1)

worked perfectly

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.