473,503 Members | 3,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dirname File

Hi.

I have a problem with a dirname. I canīt read a file if i write this code:

<?php
$user = $_REQUEST['username'];
$filename = dirname(_FILE_).'/../revadv/$user';
$lines = file($filename);
?>

I have create a file with $user name. I write in the php page which i create
the file $user name:

$user = $_POST['username']; but it isnīt well..

If I write in php page with dirname: echo "$user"; it donīt write anything.

Thank you.
Regards
Joca
Jul 16 '05 #1
2 5615

"Joca" <jo********@siadv.com> wrote in message
news:be**********@nsnmrro2-gest.nuria.telefonica-data.net...
Hi.

I have a problem with a dirname. I canīt read a file if i write this code:

<?php
$user = $_REQUEST['username'];
$filename = dirname(_FILE_).'/../revadv/$user';
$lines = file($filename);
?>

I have create a file with $user name. I write in the php page which i create the file $user name:

$user = $_POST['username']; but it isnīt well..

If I write in php page with dirname: echo "$user"; it donīt write anything.
Thank you.
Regards
Joca


If you managed to pass values successfully from the client, their variable
names and values will appear in a nice table format if you use

<?
phpinfo(INFO_VARIABLES);
?>

Jul 16 '05 #2
Joca wrote:
$filename = dirname(_FILE_).'/../revadv/$user';

^^^^^^

That should be __FILE__ (double underscores).
http://www.php.net/manual/en/languag...predefined.php

Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3910
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
5
5433
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. ...
3
3223
by: Jason | last post by:
Here's the code I'm using: #################################### import os, string for root, dirs, files in os.walk('/home/_Comedy'): for file in files: str = os.path.dirname(file) print root,...
7
3515
by: Joseph | last post by:
Hi, I'm having bit of questions on recursive pointer. I have following code that supports upto 8K files but when i do a file like 12K i get a segment fault. I Know it is in this line of code. ...
2
6985
by: Tatu Portin | last post by:
I need to implement simple function to get current directory from program directory. e.g. /home/tatu/src/main -> /home/tatu/src where main is the currently running program. i.e. argv ==...
1
3582
by: Steve | last post by:
I have been trying to find documentation on the behavior Can anyone tell me why the first example works and the second doesn't and where I can read about it in the language reference? Steve ...
2
2850
by: Tom | last post by:
I've beat my head every way I can think of against this wall. Maybe someone here just knows the answer. I'm testing an upload class on my laptop WAMP server. When I run the test script,...
1
2372
by: laredotornado | last post by:
Hi, On my php 4.4.4 environment, the call $dir = dirname(__FILE__); returns the full path of the directory. However, when I upload the above code to my hosting company's server, the call...
0
1186
by: Salve =?iso-8859-1?Q?H=E5kedal?= | last post by:
$var = "/home/user/dir/file" // To extract dir from $var, is echo basename(dirname($var)); // a silly thing to do? Salve
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7291
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7012
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.