The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
I've learnt how to make a flashy little form now! (Yay!)
Anyway, how would I manage to create a list of files within a directory?
Say I wanted to print all of the files in the directory
http://members.lycos.co.uk/phi11ip/pics/
What would I do?
Is it easy, or slightly harder than I expect in which I'll just leave it!
Thanks.
Ah...
I was all looking forward to that...
Good job none of the files work then isn't it!
They won't allwo it :)
//user defined variables
$abpath = "./games"; //Absolute path to where games are uploaded. No trailing slash
$sizelim = "no"; //Do you want size limit, yes or no
$size = "2500000"; //What do you want size limited to be if there is one
$number_of_uploads = 3; //Number of uploads to occur
if ($_REQUEST['submitted']){ // Begin processing portion of script
//all file types to upload
$cert1 = "flash/swf"; //swf flash
$log = "";
for ($i=0; $i<$number_of_uploads; $i++) {
//checks if file exists
if ($img_name[$i] == "") {
$log .= "No file selected for upload $i
";
}
if ($img_name[$i] != "") {
//checks if file exists
if (file_exists("$abpath/$img_name[$i]")) {
$log .= "File $i already existed
";
} else {
//checks if files to big
if (($sizelim == "yes") && ($img_size[$i] > $size)) {
$log .= "File $i was too big
";
} else {
//Checks if file is an image
if (($img_type[$i] == $cert1) or ($img_type[$i] == $cert2) or ($img_type[$i] == $cert3) or ($img_type[$i] == $cert4) or ($img_type[$i] == $cert5) or ($img_type[$i] == $cert6) or ($img_type[$i] == $cert7) or ($img_type[$i] == $cert8) or ($img_type[$i] == $cert9) or ($img_type[$i] == $cert10) or ($img_type[$i] == $cert11) or ($img_type[$i] == $cert12) or ($img_type[$i] == $cert13) or ($img_type[$i] == $cert14) or ($img_type[$i] == $cert15) or ($img_type[$i] == $cert16) or ($img_type[$i] == $cert17)) {
@copy($img[$i], "$abpath/$img_name[$i]") or $log .= "Couldn't copy Flash game 1 to server
";
if (file_exists("$abpath/$img_name[$i]")) {
$log .= "File $i was uploaded
";
}
} else {
$log .= "File $i is not an Flash game
";
}
}
}
}
}
?>
Log:
echo "$log";
?>
exit;
} // End processing portion of script
?>
I've found a script that works!
I'm also quite surprised how much I've learnt in the two days I've tried it too!
I've tried on Freeola to test them but it still doesn't work...
Grrr..
Fatal error: Maximum execution time of 10 seconds exceeded in listing.php on line 22
I found another one which is OK, it creates a thumbnail of all the images in the folder which could be quite useful.
Oh, and this script doesn't seem to be working no matter how hard I try:
This is the form page:
This is the PHP file:
if ($File_name){
if (copy($FileToUpload, "./photos/$File_name")){
echo 'File Name :' . $File_name .';
echo 'File Size :' . $File_size .';
echo 'The file was successfully uploaded!';}
else
echo 'Your file could not be copied.';
unlink($FileToUpload);
?>
I got a parse error on line 4 I think, my crapy attempt to fix it was this:
if ($File_name){
if (copy($FileToUpload, "./photos/$File_name")){
print ("The name of the file is $File_name");
print ("The size of the file is $File_size");
print ('The file was successfully uploaded!");}
else
print ("File not uploaded");
unlink($FileToUpload);
?>
But then I get a parse error on the last line. The close php tag.
Does anybody have any simple file/image uploading scripts?
$Folders = "";
$Folder_Count = 0;
$Files = "";
$File_Count = 0;
print "
print "
FOLDERS | \n";FILES | \n";
\n$Folders\n"; print " | \n";\n$Files\n"; print " | \n";
$Folder_Count $Folder_Text | \n";$File_Count $File_Text | \n";
print "
?>