Hi,
I have a script which is supposed to upload one file at a time. (I think) I made all the necessary changes in php.ini, namely:
post max size = 32M
file upload = on
upload directory = c:\windows (I tried with /-s as well)
upload max size = 32M
max timeout = 900
Interestingly, it does all the uploads regardless of file type, but fails to display any part of the page (not even my test-text).
Plase help me. I might have made an obvious mistake but I can't find it.
The processing code:
<?
session_start() ;
$user = $HTTP_SESSION_VARS["id"] ;
if ($HTTP_SESSION_VARS["szint"] <> "tanar")
{
header("Location: index.php") ;
}
require("include/db_kapcs2.inc") ;
echo "<h4>Hopefully, this appears on the screen!</h4>" ;
if (is_uploaded_file($userfile))
{
echo "<h4>If this appears then the upload is done!</h4>" ;
if (diskfreespace("/Program Files/Abria Merlin/Apache/htdocs/fajlok") < $userfile_size)
{
echo "<h4>Not enough disk space!</h4>" ;
}
else
{
if ($ujnev == "")
{
$nev = $userfile_name ;
}
else
{
$nev = $ujnev ;
}
db_kapcs() ;
$ell_query = "select * from feltoltes where torolve = '00000000000000' && fajlnev = '$nev'" ;
$ell_result = mysql_query($ell_query,$db) ;
$num = mysql_num_rows($ell_result) ;
if ($num<>0)
{
echo "<h4>Filename is already in use!</h4>" ;
echo "<h4>Click on your browser's Back button!</h4>" ;
}
else
{
$felv_query = "insert into feltoltes
(sorszam,fajlnev,fajlmeret,tanar,rogzites_ideje,targykod,torolve)
values
(null,'$nev','$userfile_size','$user',now(),'$targykod','00000000000000')" ;
mysql_query($felv_query,$db) ;
move_uploaded_file($userfile,"fajlok/$nev") ;
echo "<h4>$nev ($userfile_size byte) is uploaded successfully.</h4>" ;
echo "<a href='upload.php'>Upload again</a>" ;
echo "<br>" ;
echo "<a href='tanar_menu.php'>Back to Main Menu</a>" ;
}
}
}
?>