Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Preventing Interpolation in PERL

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
noelob



Joined: Mon Feb 13, 2006 11:09 am
Posts: 45
Location: Ireland

PostPosted: Tue Nov 07, 2006 9:06 pm    Post subject: Preventing Interpolation in PERL Reply with quote

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:
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!
Back to top
View user's profile Send private message
gch15



Joined: Thu Jun 09, 2005 5:00 pm
Posts: 39
Location: Norfolk, UK

PostPosted: Thu Feb 22, 2007 5:57 pm    Post subject: RE: Preventing Interpolation in PERL Reply with quote

Try:
$file1=~s/\\/\//g;
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast