Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
php string manipulation
Old 11-26-2008, 03:48 PM php string manipulation
Banned

Posts: 34
Trades: 0
hi guys, I have a form that uploads an image but must also write the path of the image to db, as it is part of a product. I am using ajax, so I can't post the file type stuff, so I am trying to do this:lets say in the text box there is:C:balaala/balala/image.jpgI am trying to get a function that returns just --image.jpgany ideas??

Last edited by Necaxa; 11-26-2008 at 03:50 PM..
Necaxa is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-26-2008, 04:30 PM Re: php string manipulation
Truly's Avatar
Ultra Talker

Posts: 322
Trades: 0
Use explode(). Have it seperate everytime you see '/' . Then use count() to find out the elements in the array (which for you represents the number of folders). Then take that number and put that into the array ($picupload[$elementscount]) Here are links explaining how to use explode and count:

http://w3schools.com/php/func_string_explode.asp
http://w3schools.com/php/func_array_count.asp
__________________
DVD Movie Release Database:
Please login or register to view this content. Registration is FREE
Truly is online now
Reply With Quote
View Public Profile
 
Old 11-26-2008, 06:31 PM Re: php string manipulation
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Quote:
Use explode(). Have it seperate everytime you see '/'
No !
Uses the functions that exists for that task:
http://php.net/basename
Quote:
basename — Returns filename component of path
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 11-26-2008, 08:18 PM Re: php string manipulation
Banned

Posts: 34
Trades: 0
that did it! the basename function work perfectly, thanks a lot.
Necaxa is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to php string manipulation
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27953 seconds with 12 queries