Forum Moderators: coopster

Message Too Old, No Replies

PHP Uploads

Uploading files (jpg, gif etc) files are there but I still receive ERROR

         

bartainer

10:14 pm on Dec 22, 2006 (gmt 0)

10+ Year Member



Hello:

I have created a script to uploads files for my site; however. When I upload a test to my folder /php_uploads/ the file is transfered but then I will receive an Internal Sever Error page. I did create a thank you page so why should I be receiving this error? Again, the file is in the folder, but I will get the error. Please advise.

Thank you.

bartainer

10:28 pm on Dec 22, 2006 (gmt 0)

10+ Year Member



500 Internal Error is what I'm getting.

smells so good

11:31 pm on Dec 22, 2006 (gmt 0)

10+ Year Member



Did you check your server error logs yet?

<add>
Sorry, wasn't trying to be short, I got hit with 2 phone calls and other things here, so I pressed Submit. You error logs will give us a clue as to the nature of the problem.
</add>

hughie

4:04 pm on Dec 23, 2006 (gmt 0)

10+ Year Member



can you post your script, might be something simple in there.

bartainer

4:57 pm on Dec 23, 2006 (gmt 0)

10+ Year Member



Keep in mind, the script is processing the information to the server (uploading files); however. I'm getting that stupid 500 error. I called my hositng company and a rep is investigating the problem.

This is only a test script the 'textfield' means nothing it's just an extra field I inserted in the form for looks. I did remove my personal email address and web site from the script.

Thanks

<?php
@$textfield = addslashes($_POST['textfield']);
@$textfield2 = addslashes($_POST['textfield2']);
@$textfield3 = addslashes($_POST['textfield3']);
@$file_Name = $_FILES['file']['name'];
@$file_Size = $_FILES['file']['size'];
@$file_Temp = $_FILES['file']['tmp_name'];
@$file_Mime_Type = $_FILES['file']['type'];

function RecursiveMkdir($path)
{
if (!file_exists($path))
{
RecursiveMkdir(dirname($path));
mkdir($path, 0777);
}
}

// Validation
if( $file_Size == 0)
{
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid file</font></p>");
}
if( $file_Size >100000000)
{
//delete file
unlink($file_Temp);
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid file</font></p>");
}
if( $file_Mime_Type!= "image/gif" AND $file_Mime_Type!= "image/jpeg" )
{
unlink($file_Temp);
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid file</font></p>");
}
$uploadFile = "php_uploads/".$file_Name ;
if (!is_dir(dirname($uploadFile)))
{
@RecursiveMkdir(dirname($uploadFile));
}
else
{
@chmod(dirname($uploadFile), 0777);
}
@move_uploaded_file( $file_Temp , $uploadFile);
chmod($uploadFile, 0644);
$file_URL = "myurl would be here to my web site".$file_Name ;

//Sending Email to form owner
# Email to Owner
$pfw_header = "From: $textfield";
$pfw_subject = "Testing";
$pfw_email_to = "";
$pfw_message = "textfield: $textfield\n"
. "textfield2: $textfield2\n"
. "textfield3: $textfield3\n"
. "file: $file_URL\n";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

//Sending auto respond Email to user
# Email to Owner
$pfw_header = "From: ";
$pfw_subject = "hello";
$pfw_email_to = "$textfield";
$pfw_message = "thanks";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

echo("<p align='center'><font face='Arial' size='3' color='#FF0000'>thank you</font></p>");
?>

bartainer

5:11 pm on Dec 23, 2006 (gmt 0)

10+ Year Member



Get this! I put the script on another web site and it worked; however. It still won't on this other site. Go figure. I think it's the way the hosting is configured on this site.

Thanks for all your help. Happy Holidays.

bartainer

5:34 pm on Dec 23, 2006 (gmt 0)

10+ Year Member



The script works on other sites; however. Just this "one" site it won't work correctly. The hosting must be configured differently?

eelixduppy

5:42 pm on Dec 23, 2006 (gmt 0)



>>The hosting must be configured differently?

That is probably the reason. If you already contacted your hosting company then I would wait for them to respond.

Happy holidays :)