Jump to content

Warptweet

Members
  • Posts

    308
  • Joined

  • Last visited

    Never

Everything posted by Warptweet

  1. Pretend I have a form... Flash Name: _ _ _ _ _ _ And in process.php, it creates a file using the inputted name... [code]$ourFileName = $_POST['flashname']; $ourFileHandle = fopen($ourFileName, 'w') or die("Sorry, cannot create file."); fclose($ourFileHandle); [/code] Of course, in this case it is creating a file. Although, when it creates a file from what the user typed inside the form field, is the file create as a .txt file? Whats the default file extension when a file is created and written in? If not, then how can I improvise that code so that the file name is $ourFileName, but with .txt extension?
  2. I use this code for my uploader. [code]<?php if (($_FILES["file"]["type"] == "application/x-shockwave-flash") && ($_FILES["file"]["size"] < 20480)) {   echo "Return Code: " . $_FILES["file"]["error"] . "<br />";   echo "Uploading " . $_FILES["file"]["name"];   echo " (" . $_FILES["file"]["type"] . ", ";   echo ceil($_FILES["file"]["size"] / 1024) . " Kb).<br />";   if (file_exists("uploads/" . $_FILES["file"]["name"])) {     echo $_FILES["file"]["name"] . " already exists.  ";     echo "Please delete the destination file and try again.";   } else {     move_uploaded_file($_FILES["file"]["tmp_name"],     "uploads/" . $_FILES["file"]["name"]);     echo "File has been stored in your uploads directory.";     $o = fopen($_POST['uploadedfile'].".txt", "w");     $stringData = $_POST['flashname'];     fwrite($o, $stringData);     $stringData = $_POST['flashauthor'];     fwrite($o, $stringData);     fclose($o);   } } else   echo "Only flash files under 20MB may be uploaded."; ?> [/code] What I'm trying to do is add extra forms to my uploader. Along with uploading the file, I want it to create an extra file with the same name as the uploaded file, except with a .txt extension, and in the .txt file I created, store the following... flashname flashauthor flashdescription (the above were the names of the forms whom the person who entered in the form stored their Flash Name, the Author, and the Flash Description)
  3. Sorry, I have another problem.... www.warptweet.com/uploadflash.php go there, try uploading a flash file or something that you just 5-second doodled. It keeps saying "you may only upload flash files under 20MB", and i made sure I meet the requirements.
  4. Umm... just wondering.... Does that CREATE [b]another[/b] file with the same name except for .txt? So in the end, I would have... XXX.swf and XX.txt both files created?
  5. Hi there, I have an upload form. When you upload a file, it obviously uploads. How can I make it so that it [b]also[/b] CREATES A .TXT FILE using the SAME name as the uploaded file, EXCEPT its a .txt file and not a .swf file? The name of the field in the browse file is uploadedfile That would probably be like $_POST['uploadedfile']; to get it the name of the file.
  6. zomg! I've made some bad mistakes!  :o lol Wait... If I close $ourFileName, will I still be able to rename it using $ourFileName? How will I be able to call that file back after renaming it in order to write things on it?
  7. I have an uploader form. And theres a problem, it gives me an error. go to www.warptweet.com/uploadflash.php It will take you to a form, try uploading a .swf (flash) file, and it will give you an error. Here is the code [code]<?php if (($_FILES["file"]["type"] == "application/x-shockwave-flash") &&   ($_FILES["file"]["size"] < $_POST['MAX_FILE_SIZE'])) {   echo "Return Code: " . $_FILES["file"]["error"] . "<br />";   echo "Uploading " . $_FILES["file"]["name"];   echo " (" . $_FILES["file"]["type"] . ", ";   echo ceil($_FILES["file"]["size"] / 1024) . " Kb).<br />";   if (file_exists("uploads/" . $_FILES["file"]["name"])) {     echo $_FILES["file"]["name"] . " already exists.  ";     echo "Please delete the destination file and try again.";   } else {     move_uploaded_file($_FILES["file"]["tmp_name"],     "uploads/" . $_FILES["file"]["name"]);     echo "File has been stored in your uploads directory.";     $flashname = $_POST['flashname'];     $flashauthor = $_POST['flashauthor'];     $flashdescription = $_POST['flashdescription'];     $ourFileName = $_POST['uploadedfile'];     $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");     rename($ourFileName, substr($ourFileName, 0, strrpos($ourFileName,'.')).'.txt');     fclose($ourFileName);     $fh = fopen($ourFileName, 'w') or die("can't open file");     $stringData = $flashname;     fwrite($fh, $stringData);     fclose($fh);   } } else   echo "Warptweet.com Error Returned: Only .swf flash files under 20MB may be uploaded."; ?> [/code] Can anyone tell me whats wrong? Or improvise on my code?
  8. Thanks. I have one more question.... When I write to a file, can I use a variable this way? [code]$stringData = "$flashname";     fwrite($fh, $stringData);[/code] As you can see, I used $stringData = "$flashname";, is that possible to use? Or will I get an error? If I can't how can I make $stringData = $flashname?
  9. Could you tell me how I would change the extension of the file called $ourFileName, and then change $ourFileName to .txt?
  10. Heres a bit different of a problem I have now... How can I rename a file EXTENSION??? Can somebody help? I think it has to do with... [code]<?php rename("XXX","XXX") ?>[/code] Except I don't know what the stuff inside the ""'s do. Can somebody explain to me how I would not rename a file, but change it from a .swf file to a .txt file, while keeping the same name besides the extension change? And after that, I need to write these variables... $flashname = $_POST['flashname'] $flashauthor = $_POST['flashauthor'] $flashdescription = $_POST['flashdescription'] I think I know how to write those variables myself though. I mainly need help with the extension changing, thanks!
  11. Thanks so much! This means so much to me!!!! I was actually wondering how to make sure the users actually put in some data... it will be usefull!
  12. Oh, lol! ONE MORE THING!!! $ourFileName = "testFile.txt"; Thats line of code. Can I do this...? $ourFileName = $_POST['flashname']; OR can I do this? (after doing $flashname = $_POST['flashname'];) $ourFileName = $flashname
  13. I found out it's POST. So... Thats mean I would do this...? $flash=$_POST['flashname'] If so... sweet! Thanks! Today is the first day I actually started "learning" PHP. I think I'm getting the hang of it!
  14. It's using the "submit" method, is that what you mean? And it leads to upload.php
  15. Hi there. This may seem confusing, but this is really just variables. I have a form.... This is what it has. Browse Files (Uploader part, I already got this covered) Flash Name: Flash Author: Flash Description: And their names are... uploadedfile (dont worry, I got the uploader part covered) flashname flashauthor flashdescription When you submit the form, it goes to upload.php. At my upload.php, how can I call the content submitted? Would I use.... uploadedfile (dont worry, I got the uploader part covered) $flashname $flashauthor $flashdescription I'm not exactly sure how I would call or use the text typed inside the forms, can anyone help? Oh, and just in case you were wondering, I'm creating a PHP file in the script with these variables in them. Although, I have some problems with this also, which too have to do with simple variable problems. $ourFileName = "testFile.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); Okay, so, for the first line. $ourFileName = "testfile.txt"; How can I make it so that "testfile.txt" is actually the name of the flash file that has been submitted? (For instance, in the "browse file" part of the form, I upload flash.swf, I need $ourFileName = the .swf flash file I uploaded) Second line $ourFileHandle = fopen($ourFileName, 'w') or die ("can't open file") I need it to write all three things submitted in the forms Flash Name Flash Author Flash Description Thanks! It's simply confusing how I get what is submitted in form text boxes into variables on the submitted page. I appreciate any help, thanks a million in advance!
  16. Errrrr.... *cough*...... les de intelligance language? Ummmm.... I dont get it. Considering that code has the <? php and ends with the ?> it kind confuses me what to take away and on, can you please do it for me? I'm REALLY sorry, but at least all it takes is to copy and paste it onto my code. :D
  17. The only thing is, I don't know WHERE inside the code to put that. Could you put it in the right spot? I'm afraid that if I put that code in the wrong line or spot inside my code, it might screw up. Do you know where? If you can add it to my code, that would be great. Thanks!
  18. I only want .gm6 files, .gm5 files, .gmd files, and .zip files to be allowed to be uploaded. Regardless of security, it DOES cut the image file uploads being annoyingly uploaded.
  19. Umm... somebody tried helping before, but it didnt work. How can I add a file extension restriction to this code? I know this has been done a million times, but I dont know where to add a file extension restriction code in this... can you help me? [code]<head><title>Warptweet.com - Uploader</title> <style type="text/css"> <!-- body {background-color: white; color: white;} a {color: white;} a:hover {font-size: 110%;} --> </style> </head> <body> <div align="center"> <fieldset> <legend>Warptweet.com File Upload</legend> <?php if ($_FILES["file"]["error"] > 0)   {   echo "Error: " . $_FILES["file"]["error"] . " ";   } else   {   echo "Filename: " . $_FILES["file"]["name"] . " ";   echo "Type: " . $_FILES["file"]["type"] . " ";   echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb ";   } if (file_exists("filer/" . $_FILES["file"]["name"]))       {       echo $_FILES["file"]["name"] . " already exists. ";       }     else       {       move_uploaded_file($_FILES["file"]["tmp_name"],       "filer/" . $_FILES["file"]["name"]);       echo "Stored in: " . "http://www.warptweet.com/wh/filer/" . $_FILES["file"]["name"];       } ?> <center><a href="index.htm"><--Back Home[/url]</center> </body> </html> [/code]
  20. Sorry, but that does not work! Could you or somebody else please try again? I know, I know, this is supposed to be really simple... I'm just confused on what place in the code to put a code at all.....  :'(
  21. I know this has been easily done many times... And I've even read the file upload tutorials, BUT.... I don't know WHERE in this code to put it... What code do I put in, and WHERE do I put the code in, to make it so that the only file types allowed to be uploaded on this code are .gm6,.gm5, .gmd, and .exe? So basically, where do I put a code for making file restrictions? CODE: [sub]<html> <head><title>Warptweet.com - Uploader</title> <style type="text/css"> <!-- body {background-color: black; color: white;} a {color: white;} a:hover {font-size: 110%;} --> </style> </head> <body> <div align="center"> <fieldset> <legend>Warptweet.com File Upload</legend> <?php if ($_FILES["file"]["error"] > 0)   {   echo "Error: " . $_FILES["file"]["error"] . "<br />";   } else   {   echo "Filename: " . $_FILES["file"]["name"] . "<br />";   echo "Type: " . $_FILES["file"]["type"] . "<br />";   echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";   } if (file_exists("filer/" . $_FILES["file"]["name"]))       {       echo $_FILES["file"]["name"] . " already exists. ";       }     else       {       move_uploaded_file($_FILES["file"]["tmp_name"],       "filer/" . $_FILES["file"]["name"]);       echo "Stored in: " . "http://www.warptweet.com/wh/filer/" . $_FILES["file"]["name"];       } ?> <center><a href="index.htm"><--Back Home</a></center> </body> </html>[/sub]
  22. Yes... but, I need the following: A way to make a form with the following possible entries: Download Link: Screenshot Link: Author: Description: ------------------------------------ And after they click the submit button, it will submit the data to a database or make a php file or something. Of course, I have a .com website and have unlimited databases available, support php and many more codes. So I wont mind if somebody gives me a code that uses mysql or anything. BUT, I also need a code that creates a table on the downloads page: Game  l  Author           l           l           l           l The "Author" will take the name of the creator which was submitted, and display it. The "Game" will create a link to a download page that is automatically created, which will display the "Download Link" which was added at the form I stated before, the download page will also display a screenshot by using the link to the screenshot image in the "Screenshot Link" field I stated above, and the download will also display the Author of the game again, and the Description aswell which would be submitted at the "Author" and "Description" field that I said above. Does anyone have a code for this? I'm quite sure this has been done many many times, simply storing information. By the way... I'm not asking for an uploader. The "Game Link" can be attached to the same file storing the "Game Link" "Screenshot Link" "Author" and "Description", which can probably be stored as variables, and recalled.
  23. I thank you all so dearly for the help. BUT, instead of a profile page, I need the download page that is created to have a download link. So this is somewhat different.
  24. Hi there. My website has a file uploading system, which people can upload their games. The only thing is, once they upload their game, they cant download or see it on my website! My website is as of now incomplete. I need a way so that my downloads page lists ALL the uploaded files in my /uploads directory, BUT, I need another thing... I need a code to MAKE a brand new page, for EACH and EVERY uploaded file in the /uploads directory. For instance, newgrounds.com, it creates a page for EACH and EVERY flash file uploaded to their website, with a downloads link. How can I do this? Anyone have a tutorial for php page creation like this?
×
×
  • 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.