Click to See Complete Forum and Search --> : file not found
kanuski
10-06-2003, 09:52 PM
I have a form on my website to upload files to the server. I uploaded several files this morning when I suddenly got a "Page not found" error. I would select a file and click submit, wait a few seconds and then the file not found page shows up. So I checked to see if the file was still there. It is. The file size limit is set at 2000 KB and the files I am uploading are only 200KB. I have no idea how to troubleshoot this. I thought the problem would have to be in the session headers but they are very simple, just session_start(); and have worked for months. I contacted the webserver technicians and asked if there were limits to the file space on the server but there is plenty of room. I asked if they had changed permissions or modified the php setting but nothing has been changed.
Any ideas would be appreciated.
PS. What is the best medication for PHP headaches?
Hmm... sounds odd.. Could we see the script? Also, make sure the permissions of the directory that the script uses to store the images is still writeable.
As far as what to use for PHP headaches, try sleep() (http://us2.php.net/manual/en/function.sleep.php)... :p
kanuski
10-06-2003, 10:59 PM
I thought I figured out the problem. A friend of mine tried it and it worked on his computer. So there was a problem on my end. Something that changed while I was working...? Temporary internet files! I deleted temp files and it worked! twice! Now I cannot get it to work again.
Anyways, here is the code.
<?
session_start();
?>
<html>
<head>
<title>Enter Image Information:</title>
</head>
<body bgcolor="#FFFFcc" text="#000000">
<?
if($uploadedfile=="none")
{
echo "<center><h2>Sorry:</h2> <p><font size=5>The server is unable to accept uploads at this time.</font></center>";
//first_mail.php
$mail_to = "digital_sask@tisdaleschooldiv.sk.ca";
$mail_subject = "Digital Saskatchewan upload error message";
$mail_body = "Dear Digital Saskatchewan \n\n Someone is having a problem uploading images to Digital Saskatchewan. \n";
$headers = "From: the Boss";
mail($mail_to, $mail_subject, $mail_body);
echo "<center><p>This error has been reported to Digital Saskatchewan and will be resolved ASAP.";
echo "<META HTTP-EQUIV='Refresh' CONTENT='4;URL=start.php'>";
EXIT;
}
?>
<P>
<center><font size=4>Online Submissions Form</font><br>
<font size=6>Step #3b: Enter File Information.</font>
</center><p>
<table align=center border=1 cellpadding=15 width="95%">
<tr><td>
<P align=center>
<?
$path3=stripslashes("$path");
// Add the file extension to the filename
$extinfo = explode(".", $path3);
$format=$extinfo[1];
$format=strtolower($format);
$ext=".$extinfo[1]";
$ext=strtolower($ext);
if($ext==".rm")
{ $ext=".ram"; }
if($ext==".jpeg")
{ $ext=".jpg"; }
if($format=="jpg" OR $format=="gif" OR $format=="png")
{
$imagehw = getimagesize($uploadedfile);
$imagewidth = $imagehw[0];
$imageheight = $imagehw[1];
}
if($ext == ".jpg" OR $ext == ".gif" OR $ext == ".png" OR $ext == ".wav" OR $ext == ".wmv" OR $ext == ".jpeg" OR $ext == ".mpeg" OR $ext == ".swf" OR $ext == ".jpeg" OR $ext == ".avi" OR $ext == ".ram" OR $ext == ".mid" OR $ext == ".mov" OR $ext == ".ra")
{
}
else
{
echo "<br>Extension: $ext<p>";
echo "<META HTTP-EQUIV='Refresh' CONTENT='0;URL=add.php?ext=bad&path=$path'>";
EXIT;
}
$filename=$filename.$ext;
?>
I have an html form here for adding info about the file.
<?
$entries++;
include ("connect.php");
mysql_query ("UPDATE contributors SET
entries='$entries'
WHERE subid=$subid
");
copy($uploadedfile, "/var/www/subsites/ischool/digitalsask/imagetemp/$subid/$filename")
?>
<p> </p>
</body>
</html>
The temporary files were probably just because the page didn't reload. It shouldn't be a problem for other users who should receive the correct version.