Prolly something dumb

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
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Prolly something dumb

Post by ol4pr0 »

Code: Select all

<?
$dir = "/usr/local/apache/htdocs/system/files";

<script language=javascript>
file = "<?php echo $uploaded; ?>"; // this part does echo the file_name
alert("We are now going to check " +file);
</script>
<?
/* here my problem starts 
 * 
 * Respuesta: Error: No se encontró el archivo $dir/$uploaded
 *                            We couldnt find the file $dir/$uploaded 
*/

$txt = new Java('txtFile', '$dir/$uploaded'); 
$answer = $txt->validar(True);
echo ("<font color=000000>Respuesta: $answer<br /><font />");

break;

}
?>
I prolly missed something here .. i am just to blind to see it
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

whats the error message?
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

error: Respuesta: Error: No se encontró el archivo $dir/$uploaded
* We couldnt find the file $dir/$uploaded

$dir / $uploaded somehow doesnt return path/example.txt

which it should since it automatcly checks a file after its being uploaded using a j++ class.
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

just something to check

personally i have PHP pages and scripts seperate

so
dir structure is like this:

index.php || login.php || handlers(directory)

are you definiely pointing to the correct file (from the correct directory otherwise the path would be wrong

just trying to eliminate the obvious
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Re: Prolly something dumb

Post by redmonkey »

ol4pr0 wrote:

Code: Select all

<?
$txt = new Java('txtFile', '$dir/$uploaded'); 
?>
Should your variables be enclosed in double quotes?
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Thanks ill mess with it somehow...
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

any idea why the fepo.txt gets changed in fepo/txt ? using the code above

fepo.txt <-----

Warning: java.lang.ClassNotFoundException: 'txtFile', 'fepo/txt' <--in /usr/local/apache/htdocs/system/upload.php on line 168

Fatal error: Call to a member function on a non-object in /usr/local/apache
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Re: Prolly something dumb

Post by ol4pr0 »

redmonkey wrote:
ol4pr0 wrote:

Code: Select all

<?
$txt = new Java('txtFile', '$dir/$uploaded'); 
?>
Sorry that is what it just wont do.. i dont get it.. since the following does return the file name

Code: Select all

<?
echo $uploaded; // will echo -> fepo.txt
echo $dir // will echo -> /usr/local/apache/htdocs/system/files 
// wich is all correct

$txt = new Java('txtFile', '$dir/$uploaded');  // this wont anymore.

?>
edit :

Code: Select all

// this will return it all fine.

$dir = "/usr/local/apache/htdocs/system/files";
$txt = new Java('txtFile', $dir/$uploaded); // line 167


My errors now :
Warning: Division by zero in line 167

Warning: java.lang.IllegalArgumentException: argument type mismatch line 167
Division by zero?
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

What I meant was, should it not be..

Code: Select all

$txt = new Java('txtFile', "$dir/$uploaded");
or...

Code: Select all

$txt = new Java('txtFile', "{$dir}/{$uploaded}");
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

That indeed did the trick.

Now i really do need some reading up on why i needed to use the double quotes to make it to work.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Click the first link in my signature.
Post Reply