fopen ect..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

fopen ect..

Post by SidewinderX »

hello im doing some work with fopen, fput and fclose, the current code that deals with these functions is listed below:

Code: Select all

$sig = "blah blah blah blah";
$fp = fopen("$pid.php", "w");
fputs($fp, $sig);
fclose($sig);
My question is when this script runs, it creates a file called $pid.php in the root directory where this script is located. How do i make it so the file $pid.php is created in /images rather then / ?led $pid.php in the root directory where this script is located. How do i make it so the file $pid.php is created in /images rather then / ?lah blah blah";
$fp = fopen("$pid.php", "w");
fputs($fp, $sig);
fclose($sig);


My question is when this script runs, it creates a file called $pid.php in the root directory where this script is located. How do i make it so the file $pid.php is c script runs, it creates a file called $pid.php in the root directory where this script is located. How do i make it so the file $pid.php is created in /images rather then / ?How do i make it so the file $pid.php is created in /images rather then / ?h these functions is listed below:

Code: Select all

$sig = "blah blah blah blah";
$fp = fopen("$pid.php", "w");
fputs($fp, $sig);
fclose($sig);
My e work with fopen, fput and fclose, the current code that deals with these functions is listed below:

Code: Select all

$sig = "blah blah blah blah";
$fp = fopen("$pid.php", "w");
fputs($fp, $sig);
fclose($sig);
My question is when this script runs, it creates a file called $pid.php in the root directory where this script is located. How do i make it so the file $pid.php is created in /images rather then / ?
$sig = "blah blah blah blah";
$fp = fopen("$pid.php", &quote;w&quote;);
fputs($fp, $sig);
fclose($sig);


My question is when this script runs, it creates a file called $pid.php in the root directory where this script is located. How do i make it so the file $pid.php is created in /images rather thquote;, &quote;w&quote;);
fputs($fp, $sig);
fclose($sig);


My question is when this script rudc60ed]
$sig = "blah blah blah blah&quote;;
$fp = fopen(&quote;$pid.php&quote;, &quote;w&quote;);
fputs($fp, $sig);
fclose($sig);


My question is when this script runs, it creates a file called $pid.php in the root directory where this script is located. How do i make it so the file $pid.php is created in /images rather then / ?d]
$sig = "blah blah blah blah";
$fp = fopen("$pid.php", "w");
fputs($fp, $sig);
fclose($sig);


My question is when this script runs, it creates a file called $pid.php in the root directory where this script is located. How do i make it so the file $pid.php is created in /images rather then / ?s located. How do i make it so the file $pid.php is created in /images rather then / ? below:

Code: Select all

$sig = "blah blah blah blah";
$fp = fopen("$pid.php", "w");
fputs($fp, $sig);
fclose($sig);
My question is when this script runs, it creates a file called $pid.php in the root directory where this script is located. How do i make it so the file $pid.php is created in /images rather then / ?ent code that deals with these functions is listed below:

Code: Select all

$sig = "blah blah blah blah";
$fp = fopen("$pid.php", "w");
fputs($fp, $sig);
fclose($sig);
My question is when this script runs, it creates a file called $pid.php in the root directory where this script is located. How do i make it so the file $pid.php is created in /images rather then / ?ah";
$fp = fopen("$pid.php", "w");
fputs($fp, $sig);
fclose($sig);


My question is when this script runs, it creates a file called $pid.php in the root directory where this script is located. How do i make it so thg);


My question is when this script runs, it creates a file called $pid.php in the root directory where this script is located. How do i make it so the file $pid.php is created in /images rather then / ? this script runs, it creates a file called $pid.php in the root directory where this script is located. How do i make it so the file $pid.php is created in /images ra current code that deals with these functions is listed below:

Code: Select all

$sig = "blah blah blah blah";
$fp = fopen("$pid.php", "w");
fputs($fp, $sig);
fclose($sig);
My question is when this script runs, it creates a file called $pid.php in the root directory where this script is located. How do i make it so the file $pid.php is created in /images rather then / ?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

add "images/" to your fopen.

ex:

Code: Select all

$fp = fopen("images/$pid.php", "w");
ges/$pid.php", "w");
our fopen.

ex:

Code: Select all

$fp = fopen("images/$pid.php", "w");
p];
php]mp;quote;w");
= fopen("images/$pid.php", "w");

$fp = fopen("images/$pid.php", "w");
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

Post by SidewinderX »

ok i have another question that evolvs around the same thing but this time lets assume that the code im using is in the direcrory /admin. How can i create the $pid.php in the root directory or the /images direcory?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Just include the parent directory ".." in the path.....

Code: Select all

../

or

../images
Post Reply