why wouldn't this work?
PHP Code:
<?php
$dirname = md5(rand());
if (@mkdir ($dirname, 0777)) {
echo 'Directory created!';
}
$fp = fopen ('dirname.inc.php', 'w');
fwrite ($fp, "<?php \$dirname = '$dirname'; ?>");
fclose ($fp);
?>
Then just include dirname.inc.php into your view script and you know the name of the dir and no one else will.
Note: I have not tested this code. There might be some parse errors and such.
As for viewing files, you can set the headers so that you view them instead of downloading them. You should check for GIF, PNG, JPG, or HTML extensions (file.gif) and set the headers specially for them. Then if the file isn't one of those you can simply use the application/octet-stream (i think thats it) content-type and it will be presented for download.
Bookmarks