Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. Is Windows Server Support File Uploads? [modified]

Is Windows Server Support File Uploads? [modified]

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
helpwindows-admincsharpphpasp-net
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Arunkumar Koloth
    wrote on last edited by
    #1

    Hi All Now Iam In A Problem Is it possible to upload file to a windows server? i used this code for uploading file i got this code from w3schools.com

    Filename:

    if ((($_FILES["file"]["type"] == "image/gif")
    || ($_FILES["file"]["type"] == "image/jpeg")
    || ($_FILES["file"]["type"] == "image/pjpeg"))
    && ($_FILES["file"]["size"] < 20000))
    {
    if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
    else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    if (file\_exists("upload/" . $\_FILES\["file"\]\["name"\]))
      {
      echo $\_FILES\["file"\]\["name"\] . " already exists. ";
      }
    else
      {
      move\_uploaded\_file($\_FILES\["file"\]\["tmp\_name"\],
      "upload/" . $\_FILES\["file"\]\["name"\]);
      echo "Stored in: " . "upload/" . $\_FILES\["file"\]\["name"\];
      }
    }
    

    }
    else
    {
    echo "Invalid file";
    }

    This Script is Working Good On My Local wamp server and also working fine in my linux server i checked phpinfo() of my windows server fileupload is on and max_upload size is 32 mb Thease Are My Server informations OS/Hosting Type: Windows / 4GH Web Hosting Hosting Configuration: .Net Runtime Version: ASP.Net 2.0/3.0/3.5 PHP Version: PHP 5.3 IIS Version: IIS 7.0 Please Help Me To Do This Arunkumar.T :((

    modified on Thursday, August 4, 2011 7:02 AM

    C 1 Reply Last reply
    0
    • A Arunkumar Koloth

      Hi All Now Iam In A Problem Is it possible to upload file to a windows server? i used this code for uploading file i got this code from w3schools.com

      Filename:

      if ((($_FILES["file"]["type"] == "image/gif")
      || ($_FILES["file"]["type"] == "image/jpeg")
      || ($_FILES["file"]["type"] == "image/pjpeg"))
      && ($_FILES["file"]["size"] < 20000))
      {
      if ($_FILES["file"]["error"] > 0)
      {
      echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
      }
      else
      {
      echo "Upload: " . $_FILES["file"]["name"] . "<br />";
      echo "Type: " . $_FILES["file"]["type"] . "<br />";
      echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
      echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

      if (file\_exists("upload/" . $\_FILES\["file"\]\["name"\]))
        {
        echo $\_FILES\["file"\]\["name"\] . " already exists. ";
        }
      else
        {
        move\_uploaded\_file($\_FILES\["file"\]\["tmp\_name"\],
        "upload/" . $\_FILES\["file"\]\["name"\]);
        echo "Stored in: " . "upload/" . $\_FILES\["file"\]\["name"\];
        }
      }
      

      }
      else
      {
      echo "Invalid file";
      }

      This Script is Working Good On My Local wamp server and also working fine in my linux server i checked phpinfo() of my windows server fileupload is on and max_upload size is 32 mb Thease Are My Server informations OS/Hosting Type: Windows / 4GH Web Hosting Hosting Configuration: .Net Runtime Version: ASP.Net 2.0/3.0/3.5 PHP Version: PHP 5.3 IIS Version: IIS 7.0 Please Help Me To Do This Arunkumar.T :((

      modified on Thursday, August 4, 2011 7:02 AM

      C Offline
      C Offline
      cjoki
      wrote on last edited by
      #2

      use this to make sure the file is posting the data to the server.

      ";
      print_r($_POST);
      print_r($_FILES);
      echo "

      "; ?> place that at the top of the script you are posting to (upload_file.php) and run it. If your post and files are getting to the server then look at your file permissions of the target directory and of the upload_file.php and make sure they are permitted to do what you want them to do.

      Chris J www.redash.org

      A 1 Reply Last reply
      0
      • C cjoki

        use this to make sure the file is posting the data to the server.

        ";
        print_r($_POST);
        print_r($_FILES);
        echo "

        "; ?> place that at the top of the script you are posting to (upload_file.php) and run it. If your post and files are getting to the server then look at your file permissions of the target directory and of the upload_file.php and make sure they are permitted to do what you want them to do.

        Chris J www.redash.org

        A Offline
        A Offline
        Arunkumar Koloth
        wrote on last edited by
        #3

        Thank you For Helping me cjoki I Done What you Said Igot this message i got message like this

        Array
        (
        [submit] => Submit
        )
        Array
        (
        [file] => Array
        (
        [name] => Water lilies.jpg
        [type] => image/jpeg
        [tmp_name] => D:\Temp\php\php9B61.tmp
        [error] => 0
        [size] => 83794
        )
        )

        I Thing It Seems Ok But The File Uploading Is Failed Can you Tell Me Why This Happen ? Please Help Me? Arunkumar.T :((

        C 1 Reply Last reply
        0
        • A Arunkumar Koloth

          Thank you For Helping me cjoki I Done What you Said Igot this message i got message like this

          Array
          (
          [submit] => Submit
          )
          Array
          (
          [file] => Array
          (
          [name] => Water lilies.jpg
          [type] => image/jpeg
          [tmp_name] => D:\Temp\php\php9B61.tmp
          [error] => 0
          [size] => 83794
          )
          )

          I Thing It Seems Ok But The File Uploading Is Failed Can you Tell Me Why This Happen ? Please Help Me? Arunkumar.T :((

          C Offline
          C Offline
          cjoki
          wrote on last edited by
          #4

          Your file upload did not fail...but looking at your echoed $_FILES data and your code snip the issue looks to be in this area...can you see it?

          if ((($_FILES["file"]["type"] == "image/gif")
          || ($_FILES["file"]["type"] == "image/jpeg")
          || ($_FILES["file"]["type"] == "image/pjpeg"))
          && ($_FILES["file"]["size"] < 20000))

          compare this to your last post.

          Chris J www.redash.org

          A 1 Reply Last reply
          0
          • C cjoki

            Your file upload did not fail...but looking at your echoed $_FILES data and your code snip the issue looks to be in this area...can you see it?

            if ((($_FILES["file"]["type"] == "image/gif")
            || ($_FILES["file"]["type"] == "image/jpeg")
            || ($_FILES["file"]["type"] == "image/pjpeg"))
            && ($_FILES["file"]["size"] < 20000))

            compare this to your last post.

            Chris J www.redash.org

            A Offline
            A Offline
            Arunkumar Koloth
            wrote on last edited by
            #5

            if ((($_FILES["file"]["type"] == "image/gif")
            || ($_FILES["file"]["type"] == "image/jpeg")
            || ($_FILES["file"]["type"] == "image/pjpeg"))
            && ($_FILES["file"]["size"] < 20000))

            Yes I Removed These Statements From My Code Now Uploading is working fine but how can i validate file type and file errors ? is there any other way to do this? Thankyou Arunkumar.T :((

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups