Jump to content

Forbidden 404 error file upload / unable to load phpfreaks.com


gterre

Recommended Posts

I am trying to successfuly run a file upload script, however when i press the submit button, I get the following error

[img]http://www.geocities.com/gpterre/images/forbidden404.jpg[/img]

my code is as follows:

<?php
$maxsize=28480; //set the max upload size in bytes
if (!$HTTP_POST_VARS['submit']) {
  //print_r($HTTP_POST_FILES);
  $error=" ";
//this will cause the rest of the processing to be skipped
//and the upload form displays
}
if (!is_uploaded_file($HTTP_POST_FILES['upload_file']['tmp_name']) AND
!isset($error)) {
  $error = "<b>You must upload a file!</b><br><br>";
  unlink($HTTP_POST_FILES['upload_file']['tmp_name']);
}
if ($HTTP_POST_FILES['upload_file']['size'] > $maxsize AND !isset($error)) {
  $error = "<b>Error, file must be less than $maxsize bytes.</b><br><br>";
  unlink($HTTP_POST_FILES['upload_file']['tmp_name']);
}
if($HTTP_POST_FILES['upload_file']['type'] != "image/gif" AND
$HTTP_POST_FILES['upload_file']['type'] != "image/pjpeg" AND
$HTTP_POST_FILES['upload_file']['type'] !="image/jpeg" AND !isset($error)) {
  $error = "<b>You may only upload .gif or .jpeg files.</b><br><br>";
  unlink($HTTP_POST_FILES['upload_file']['tmp_name']);
}
if (!isset($error)) {
copy($HTTP_POST_FILES['upload_file']['tmp_name'],"uploads/".$HTTP_POST_FILES
['upload_file']['name']);
  unlink($HTTP_POST_FILES['upload_file']['tmp_name']);
  print "Thank you for your upload.";
  exit;
}
else
{
  echo ("$error");
}
?>

<html>
<head></head>
<body>
<form action="<?=$PHP_SELF?>" method="post" enctype="multipart/form-data">
Choose a file to upload:<br>
<input type="file" name="upload_file" size="40">
<br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>



Also on another note, I cannot access phpfreaks.com or any of its directory pages.. All i get is a blank page, and this is on the computer that i installed wamp on which has php mysql and apache on it. can someone please help me with this because it is a pain transfering information from on computer to another just to request for help on this forum. thanks.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.