Jump to content

[SOLVED] Save file


paulman888888

Recommended Posts

hi.

 

I have a form that summits code useing the 'post' action and i would like a script that gets the post data and saves it as a new file in directory games.

 

I would like the name to be anything.php

 

i mean anything, number or what ever.

 

thankyou

Link to comment
Share on other sites

As a noob i don't know how much there was left to do.

 

I started with get post.

And had loads of gos trying to get it to save the file.

 

I got the random file name part done.

 

As you can tell i am not very smart with PHP.

 

Thankyou all ver much again.

Link to comment
Share on other sites

can you post the code you have so far..

 

may i ask why you want it random! (just curious)

 

I just don't want it to over right a file that is already there and i thought RANDOM would be a good way to prevent it.

 

Am really sorry but when i couldn't do it I delete it of local on my server.

 

Sorry

Link to comment
Share on other sites

I just don't want it to over right a file that is already there and i thought RANDOM would be a good way to prevent it.

bad move, you can still over write files..

 

Am really sorry but when i couldn't do it I delete it of local on my server.

well attempt to write one and post the code and where your stuck, if you really don't want to spend the time then

try the freelance section

Link to comment
Share on other sites

I can't do this.

 

It's too hard for me.

 

I know this will sound abit weird but can someone make a template for me please.

 

I've tryed and now its (a word that am not going to say because were not allowed to swear on these forums but i think you can guess it. But i will say it's a 7 letter word,

begging with p

has two s's init,

and ends in 'ing' )

 

Please help!

Link to comment
Share on other sites

Below it my code. Please can you check it for errors as i am not very good.

<?php

$ourFileName = "games/$_POST[name].php";
$ourFileHandle = fopen($ourFileName, 'w') or die("Can't make file");
fclose($ourFileHandle);

$myFile = "games/$_POST[name].php";
$fh = fopen($myFile, 'w') or die("There's an error!");
$stringData = "$_POST[main].php";
fwrite($fh, $stringData);
fclose($fh);

?>

 

This is what it's meant to do.

 

Its meant to create a file in directory games. With the name from POST DATA NAME

 

Then its meant to add the content from POST DATA MAIN

 

Thank-you for all the help

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.