List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 7 2001 3:46am
Subject:Re: Showing image
View as plain text  
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, paul@stripped
Thread
Showing imageDawn H7 Jul
  • Re: Showing imagePaul DuBois7 Jul