hi everybody

i am trying to unload image(jpg/gif) through php code but not working my Web Server detail is given below

my web server : ISAPI
System : Windows NT SERVER16 5.2 build 3790

Configure Command : cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"

Configuration File (php.ini) Path : C:\WINDOWS

Loaded Configuration File : C:\WINDOWS\php.ini

PHP API : 20041225

PHP Extension : 20060613

Zend Extension : 220060519

Debug Build : no

Thread Safety : enabled

Zend Memory Manager : enabled

IPv6 Support : enabled

Registered PHP Streams : php, file, data, http, ftp, compress.zlib

Registered Stream Socket Transports : tcp, udp

Registered Stream Filters : convert.iconv., string.rot13, string.toupper, string.tolower, string.strip_tags, convert., consumed, zlib.*

when i am trying to upload with $_FILE[] but not wrking plz some body help me in this.

    Any particular reason you think the problem is with your server configuration and not with your PHP code? Or for that matter, did you remember to include the enctype="multipart/form-data" attribute in your <form> tag?

      my test.php page have this code
      <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
      <html xmlns='http://www.w3.org/1999/xhtml'>
      <head>
      <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-9' />
      <title>welcome to ermata&#351;</title>
      </head>
      <body>
      <form enctype="multipart/form-data" action="uploader.php" method="POST">
      <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
      Choose a file to upload: <input name="uploadedfile" type="file" /><br />
      <input type="submit" value="Upload File" />
      </form>
      </body>
      </html>

      and uploader.php page have this code

      <?php
      $target_path = "uploads/";
      $target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

      if(move_uploaded_file($FILES['uploadedfile']['tmp_name'], $target_path)) {
      echo "The file ". basename( $
      FILES['uploadedfile']['name']).
      " has been uploaded";
      } else{
      echo "There was an error uploading the file, please try again!";
      }
      ?>

      i am new in PHP but i am thinking becoz my server is ISAPI dont have Apache maybe that is problem need to change code maybe call asp.net function for upload image.

      but in my home computer this codes are wrking coz have Apache web server.

        To help narrow down what the problem is, try adding some debugging code:

        <?php
        // turn on all run-time errors:
        ini_set('display_errors', 1);
        error_reporting(E_ALL);
        
        $target_path = "uploads/";
        $target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
        
        if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
           echo "The file ". basename( $_FILES['uploadedfile']['name']).
        " has been uploaded";
        } else{
           echo "There was an error uploading the file, please try again!";
           echo "<pre>".print_r($_FILES,1)."</pre>\n";
        }
        ?>
        

        Hopefully this will give us some clue as to where things are going wrong, and if we're lucky, why.

          hi, thanks for code, i used above code for see error and its give this error

          Warning: move_uploaded_file(uploads/10x10.gif) [function.move-uploaded-file]: failed to open stream: No such file or directory in D:\inetpub\ermatas.com\www\uploader.php on line 9

          Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\php\upload\php27B.tmp' to 'uploads/10x10.gif' in D:\inetpub\ermatas.com\www\uploader.php on line 9
          There was an error uploading the file, please try again!
          Array
          (
          [uploadedfile] => Array
          (
          [name] => 10x10.gif
          [type] => image/gif
          [tmp_name] => C:\php\upload\php27B.tmp
          [error] => 0
          [size] => 49
          )

          )

            Does the "D:\inetpub\ermatas.com\www\uploads" directory exist, and is it readable and writable by all?

              hi, when i am using FTP i can see just www folder and inside www folder i made uploads folder, all folders have already 777 permission.

              when in checking my phpinfo() its giving upload_tmp_dir : C:\php\upload
              should i need to change this value.

              thankx

                Write a Reply...