Re: How can I create a file with filename as
by Pug (Monk) on Jun 24, 2002 at 13:25 UTC
|
Use open like you would for any other file.
Like this.
open WFILE, "> default.asp?11=1"
or die "Can't open default:$!";
print WFILE $data;
close WFILE;
| [reply] [d/l] |
Re: How can I create a file named
by dwatson06 (Friar) on Jun 29, 2002 at 14:02 UTC
|
Is '11=1' not part of your Get?
Normally pages are created as 'pagename.(asp,pl, cgi, etc)'.
The question mark tells the page that there are parameters coming in. For this one, 11 is 1. So if you create an asp page as default.asp then call it passing ?11=1.
If it's vbscript (ASP) then you can just put in tags...
<%=response.write 11%>
and it should print out 1. | [reply] |
Re: How can I create a file named
by Anonymous Monk on Jun 26, 2002 at 02:05 UTC
|
Depending on the file system that you are trying to save it to, you may not be able to.
FAT, FAT32, and NTFS don't allow '?' in the file name.
Looking at the extension I suspect that is probably the problem, you'll have to use another character.
or, just do something like hex encode the filename, like
my $name = "abba?@fzabb=11'a";
$name = unpack 'H*', $name;
# name is now 616262613f3d31312761
To retrieve the original name you'd pack it instead of unpack'ing.
| [reply] [d/l] |
Re: How can I create a file named
by screamingeagle (Curate) on Jun 25, 2002 at 01:32 UTC
|
open WFILE,">default.asp\?11=1" or die "error : $!";
print WFILE "test data";
close WFILE;
Originally posted as a Categorized Answer. | [reply] [d/l] |
Re: How can I create a file named "default.asp?11=1"?
by igoryonya (Pilgrim) on Dec 06, 2009 at 12:59 UTC
|
I agree with the hex conversion in file names, but I'd say only convert file name invalid characters to hex as it's done in URLEncode almost.
The invalid characters in windows filenames are:
\/:*?"<>|
append % to the beginning of the encoded char and also encode the % char.
my $name = "abba?@fzabb=11'a"
$name =~ s/([\\\/:\*\?"<>\|])/\%unpack('H*', $1)/g;
# name is now: abba%3f@fzabb=11'a%22
Or you can use ord instead of unpack.
| [reply] [d/l] |
Re: How can I create a file named
by ycjj (Initiate) on Jun 26, 2002 at 02:25 UTC
|
| [reply] |
Re: How can I create a file named
by ycjj (Initiate) on Jun 25, 2002 at 01:50 UTC
|
| [reply] |
Re: How can I create a file named
by ycjj (Initiate) on Jun 25, 2002 at 00:40 UTC
|
| [reply] |