Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 08-21-2005, 06:32 AM   #1 (permalink)
salmanjoo
Registered User
 
Join Date: Aug 2005
Posts: 18
salmanjoo is on a distinguished road
changing file permission

hi guys
how to change file permission
i have to edit the file for this i m checking the file permission so
if the file is not write able so hw to do it
means change file to write able mode
salmanjoo is offline   Reply With Quote
Old 08-21-2005, 08:55 AM   #2 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 598
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
I'll be honest. Your posts are very very difficult to understand, I'm not sure if it's english as a second language or just that you are in a hurry. Please try to be more clear as to what you are asking.

For changing a file from php http://www.php.net/manual/en/function.chmod.php
Else, use the unix chmod command.
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote
Old 08-22-2005, 04:00 AM   #3 (permalink)
veedee
Registered User
 
Join Date: Jul 2004
Posts: 4
veedee is on a distinguished road
Post your php code, we'll review it. If you couldnot change file permission thru CHMOD() function, maybe you must change it via ftp_site() function
veedee is offline   Reply With Quote
Old 08-22-2005, 10:39 AM   #4 (permalink)
salmanjoo
Registered User
 
Join Date: Aug 2005
Posts: 18
salmanjoo is on a distinguished road
here is my code fellows
<?php
$file = $menu1; //i m selecting the file from form feild menu1
fopen ("$file", "wb");
?>
<form name="form1" method="post" action="savefile.php">
<p><span class="consign style2">EDIT FILE:</span><span class="style1"><br>
</span><span class="headerlink">HERE IS YOUR FILE WHICH YOU SELECTED FROM YOUR FILEMANAGER </span></p>
<p><span class="style1">
<textarea name="editarea" cols="60" rows="50" id="editarea"><?php readfile($file);?></textarea>

file is not opening in textarea
so tell me the mistahe of my code or how should i make the ode for this
thanks
salmanjoo is offline   Reply With Quote
Old 08-22-2005, 11:19 AM   #5 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,710
redhead is on a distinguished road
Quote:
Code:
fopen ("$file", "wb");
this is opening the file as Write Binary, I'm not sure that's what you want, when you wan't to use readfile() on it.
If you plan on using readfile(), then you won't need the fopen(), allready your fopen() will lock the file for writing, befor you start reading from it and in php it is not allowed to have a file-pointer which is intended to write to a file, at the same time as you want to read from it.
Code:
 <form name="form1" method="post" action="savefile.php">
<p><span class="consign style2">EDIT FILE:</span><span class="style1"><br>
</span><span class="headerlink">HERE IS YOUR FILE WHICH YOU SELECTED FROM YOUR FILEMANAGER </span></p>
<p><span class="style1">
<textarea name="editarea" cols="60" rows="50" id="editarea"><?php readfile($menu1);?></textarea>
should do it, unless you have a real intention on having to open a filepointer to the file.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 08-23-2005, 04:49 AM   #6 (permalink)
salmanjoo
Registered User
 
Join Date: Aug 2005
Posts: 18
salmanjoo is on a distinguished road
hi
so how to open a file for writting tell little bit with code
plzzzzzzzzzz
thnx
salmanjoo is offline   Reply With Quote
Old 08-23-2005, 12:26 PM   #7 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,710
redhead is on a distinguished road
Code:
$fp=fopen($file_name, "a+");
fseek($fp, SEEK_SET);
while($str=fgets($fp))
  echo $str ."<br>";
fseek($fp, SEEK_SET);
fwrite($fp, $some_text, strlen($some_text));
fclose($fp);
But I don't see why you want to write to a file while opening it for displaying in your window, usualy you let the user see the file, make changes to it, and then uppon submitting the changes you open the file and rewrite it with the contence the user changed it to.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 08-23-2005, 12:32 PM   #8 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
also the php manual is great for code reference : http://us3.php.net/manual/en/function.fwrite.php
__________________
Mike
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
'old-skool' server code enhancement zyrxfz Standard C, C++ 11 06-14-2005 05:17 AM
Output problem with file manipulation (newbie) crazyant Java 4 03-11-2005 01:03 PM


All times are GMT -8. The time now is 04:50 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting