Jump to content

Uploaded file recognition error


JLitkie

Recommended Posts

So im having an issue with uploading files to the server on yahoo using a script I wrote.  I have it to where it uploads the files and put them where they need to go, however the server wont recongise them as being authorized files.  When I look they look normal and everything.  When I upload the same file thorugh their upload page it works.  It is acting as if it has a special code written to it when its uploaded.

 

Here is the coding

 

<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 200000))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {

    if (file_exists("../Graphics/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "../Graphics/" . $_FILES["file"]["name"]);
      }

$Name = $_POST['Name'];
$Pic = $_FILES["file"] ["name"];
$Category = $_POST['Category'];

include("database.php");

mysql_select_db("bluemoonmastiff", $con);
  
  $sql="INSERT INTO gallery (Name,PicAddress,Category)
              VALUES ('$Name','../Graphics/$Pic','$Category')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }

     include("photos.php");
    }
  }
else
  {
  echo "Invalid file";
  }
?> 

Link to comment
https://forums.phpfreaks.com/topic/204147-uploaded-file-recognition-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.