Preventing Interpolation in PERL

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

Preventing Interpolation in PERL

Postby noelob » Tue Nov 07, 2006 9:06 pm

Hi All,

I am building a dynamic image gallery for a local companys website, to allow them to upload images to the web server, add galleries to the website and assign images to each gallery.

I am using PERL CGI on the server to handle all the uploading etc. The problem is that the customer has Windows 2000 with IE, so typical files being uploaded might be C:\Images\image.jpg. When the absolute file names are received at my script, the backslashes are interpolated when I use:
Code: Select all
my $file1 = $cgi->param('file1');
I am currently using File::Basename to extract the basename of the file but it does not work correctly due to the backslashes. What it the best way to prevent interpolation of the backslashes?

Thanks,
Noel

P.S. If it's not already obvious, I'm pretty new to PERL!
User avatar
noelob
 
Posts: 45
Joined: Mon Feb 13, 2006 11:09 am
Location: Ireland

RE: Preventing Interpolation in PERL

Postby gch15 » Thu Feb 22, 2007 5:57 pm

Try:
$file1=~s/\\/\//g;
gch15
 
Posts: 39
Joined: Thu Jun 09, 2005 4:00 pm
Location: Norfolk, UK


Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests