Re: [webmin-devel] Temporary files
Jamie Cameron <[email protected]>
| Newsgroups | gmane.comp.web.webmin.devel |
|---|---|
| Message-ID | <[email protected]> |
The best solution is to use Webmin's tempname function, which will
return a filename under /tmp/.webmin suitable for use as a temporary
directory. Your code would look something like :
$tempdir = &tempname();
mkdir($tempdir, 0700);
$tempfile = "$tempdir/whatever";
...
system("rm -rf ".quotemeta($tempdir));
The only important thing to remember is to remove the temporary
directory before your script exits, as the rm -rf command above does.
Otherwise, you run the risk of filling up the filesystem with data that
is no longer needed ..
- Jamie
On Wed, 2004-07-21 at 08:14, Sandro Dentella wrote:
> I need to use temporary files. Where should I put them?
> I'm writing an interface to manage dar archives from backup. People look in
> a database find the precious file and click on it. File must be extracted
> from the archive and served. Where should I extract it.
>
> Of course it would work, creating a temp dir *inside*
> /usr/share/webmin/my_module.... but that would be against any Filesystem
> Hyerarchy Standard.
>
> Otherwise I should create a wrapper cgi that picks file that I extract under
> /tmp/ os /var/tmp, is there any other, possibly smarter solution?
>
>
> TYA
> sandro
> *:-)
>
>
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
-
Forwarded by the Webmin development list at [email protected]
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel