Jump to content

napalm

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

napalm's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry for the double post but i got this figured out! what i did is i opened the directory and listed each directory and just added the fwrite an what not where the list goes like this: <?php $dirname = "dir/"; $dirread = opendir($dirname); while(false != ($file = readdir($dirread))) { if(($file != ".") and ($file != "..")) { $dir='dir/'.$file.''; $myFile = ''.$dir.'.txt'; $fh = fopen($myFile, 'x+') or die("can't open file"); $content = "content blah blah"; fwrite($fh, $content); fclose($fh); }} ?> an it worked this way! Just for any one wondering Thanks guys!
  2. yeah im going to end up having to do that but its going to go to multiple directories just wanted to see if there was a simple way of just serperating them.
  3. damn, so is there any other way other then fwrite,fopen possibly to create multiple files?
  4. I guess, its all up to you... I like to include things to make it a bit more organized for me when im coding a big site... When i'm including pages ill do something on the index like: include(header.php); if($_GET['page']){ if(!file_exists($page . '.php')){ $page = "error"; }else{ $page = $_GET['page']; } }else{ $page = "homepage.php"; } include($page.'.php'); include(footer.php); having it set homepage.php the default if no user is going to a page (index.php?page=pagename)... another reason i like if it happens (knock on wood) i'll get hacked (injected or what not) or what not they usually will just change the index.php being its the main file.. and i wont loose the whole template just the simple php that was including the important parts of the site. get me?
  5. is there any way to create/write not just one file but multiple in one fwrite? so writing one file is like this yah? $dir='dir/'; $myFile = ''.$dir.'file.txt'; $fh = fopen($myFile, 'x+') or die("can't open file"); $content = "content blah blah"; fwrite($fh, $content); theres no way to possibly like separating in the fopen to multiple files with a ,? $dir='dir/'; $myFile = ''.$dir.'file.txt'; $myFile2 = ''.$dir.'file2.txt'; $fh = fopen($myFile,$myFile2 'x+') or die("can't open file"); $content = "content blah blah"; fwrite($fh, $content); or with ||? $dir='dir/'; $myFile = ''.$dir.'file.txt'; $myFile2 = ''.$dir.'file2.txt'; $fh = fopen($myFile || $myFile2 'x+') or die("can't open file"); $content = "content blah blah"; fwrite($fh, $content); any ideas? thanks
  6. Yeah, thats if i want to put the file INTO the directory.. could u help me out were i set the directory like the one i have all ready? (im slow sowy)
  7. Its mostlikly that the script you are trying to install (its a install.php script right) has errors and thats why it wont install but if they are trying to say u need to install anything other then a php file or somthing like that it may be more then a script bro...
  8. make sure <?php if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?> is inside a file called, uploadFile.php.... spelled just like that. http://www.mystored.info/up/ ive tested the script and it works fine... as you can see i run a upload site if you need help just email me :} but any ways make sure, the <html> <body> <form action="uploadFile.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </body> </html> is in index.php and <?php if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?> is in fileUpload.php mmmkay :} all good.
  9. Hey, need some quick help... a simple, that cant be done would be nice but i would like if i could get some help on this.. The script im working with: <? $path = "./uploads/"; $dir_handle = @opendir($path) or mkdir("./uploads/); while ($file = readdir($dir_handle)) { if($file == "." || $file == ".." || $file == "index.php" ) continue; echo "$file"; } closedir($dir_handle); ?> displays files in the directory that i put.. but is there, any way that i can have it so i can set where it only displays, file types like gif, jpg, etc... so if in the directory theres html, swf, etc in the directory it does not show them... just the files i set... thanks!
  10. atm.. yes.. i want a cnp solution.. realllyyy sleepy and not thinkging straight but wants to finish what ever im working on idk atm hahaha.. sorry bout this thanks though!
  11. nono.... like: <form action="" method="post"> <input type="button" name="create" value="create_file"> </form> <?php if (isset($_POST['create'])) { $create = "File.html"; $create = fopen($create, 'w') or die("can't open file"); fclose($ourFileHandle); } ?> ????
  12. Great! Umm and if i want it so it sets the name of the file?
  13. No help for what im doing.. i need a button i guess i can try and code somthing.. and play around with stuff but me kinda lazy XD
  14. No im pretty sure you can do this in php yeah i know fwrite.. but thats only when u vist the page it creates it im wondering if theres a way for when u click a link it does it? i know about all them.. BUT ON A BUTTON CLICK...
  15. is there a way to create a file once a button is created? like have a button and when it is clicked it creates a html file into a directory? and possibly have a button when the button is clicked to create it have it so it changes to a remove button and it removes the html file?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.