At 9:50 PM -0500 7/6/01, Dawn H wrote:
>If I save the image name in the database, I can call it that way.
>BUT when the file is uploaded, it saves the whole path in
>the database  (ie C:\Path1\Path2\filename.jpg). How do I
>break that up to make it save just "filename.jpg" and not the
>whole path?
>
>Thanks,
>Dawn

If you're doing this in Perl:

$x = "C:\\Path1\\Path2\\filename.jpg";
print "$x\n";
$x =~ s/.*\\//;
print "$x\n";

If you're doing it in MySQL:

mysql> set @x := 'C:\\Path1\\Path2\\filename.jpg';
mysql> select @x;
+-----------------------------+
| @x                          |
+-----------------------------+
| C:\Path1\Path2\filename.jpg |
+-----------------------------+
mysql> select substring_index(@x,'\\',-1);
+-----------------------------+
| substring_index(@x,'\\',-1) |
+-----------------------------+
| filename.jpg                |
+-----------------------------+



>
>http://www.rdcss.com/ - R&D Computer Solutions
>http://wow.cooncheese.com/ - WOW.CoonCheese.com
>http://dpenguin.rdcss.com/ - Cornucopia
>  Filter fixer: database,sql,query


-- 
Paul DuBois, [EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to