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
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Tue Mar 23, 2004 9:02 am
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 » Tue Mar 23, 2004 9:04 am
whats the error message?
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Tue Mar 23, 2004 9:12 am
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 » Tue Mar 23, 2004 9:14 am
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
Post
by redmonkey » Tue Mar 23, 2004 9:18 am
ol4pr0 wrote: Code: Select all
<?
$txt = new Java('txtFile', '$dir/$uploaded');
?>
Should your variables be enclosed in double quotes?
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Tue Mar 23, 2004 9:19 am
Thanks ill mess with it somehow...
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Tue Mar 23, 2004 9:24 am
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
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Tue Mar 23, 2004 9:35 am
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 » Tue Mar 23, 2004 9:46 am
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}");
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Tue Mar 23, 2004 9:56 am
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.
m3mn0n
PHP Evangelist
Posts: 3548 Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada
Post
by m3mn0n » Tue Mar 23, 2004 3:25 pm
Click the first link in my signature.