Re: moving files
by flyfishin (Monk) on May 24, 2000 at 21:28 UTC
|
What about using File::Copy? Assuming the web server has write
permission in the directory where you want to place the file
File::Copy should do what you want. | [reply] |
Re: moving files
by perlcgi (Hermit) on May 24, 2000 at 21:35 UTC
|
Using an upload like this just add something basic like the following
my $target = "/tmp/whatever";
open (OUTFILE, ">$target") or die "Could'nt open $target:$! \n";
print OUTFILE $file;
close;
If you are using NT or an OS that distinguishes binary mode from test files add binmode OUTFILE; after the open statement above.
| [reply] [d/l] [select] |
|
|
Using binmode is always good practice,
regardless of the OS you're programming for - it has no overhead on
systems that don't need it AFAIK
Your proposed method of printing into the new file has the drawback
(or the effect) that neither the original file time nor the original
file attributes (as they are on the file system) get
preserved.
| [reply] |
|
|
Sorry about the typo:
an OS that distinguishes binary mode from test files
should read
an OS that distinguishes binary mode from text files.
| [reply] |
Re: moving files
by httptech (Chaplain) on May 24, 2000 at 20:41 UTC
|
Not sure what you want to do here exactly; are you wanting
to have a user upload a file to the server through your script?
Or do you just want to give them control to manipulate a file that is already on
the server?
| [reply] |
|
|
The user will upload a file and my script will grab that
filename, but from there how do I move the file.
| [reply] |
RE: moving files
by ZZamboni (Curate) on May 24, 2000 at 23:38 UTC
|
| [reply] |
|
|
Under Win32 variants (Win9x and Windows NT and Windows 2000), rename works a
expected, that is, it can move within one file system.
| [reply] |
Re: moving files
by lhoward (Vicar) on May 24, 2000 at 21:32 UTC
|
Are you asking how you move the file? Or how you
process a file uploaded via a FORM's
<input type="file"...> tag?
Or are you asking how to deal with a form in which
a user enters a filename in one field and the file's contents
in another (textarea) field? I guess I don't understand your
question. Can you elaborate? | [reply] [d/l] |