php - Where does move_uploaded_file store the file? -


i trying upload file through web form. script outputs following, , there no errors. still can not find directory on server. specifying location wrong? tried /upload , full path see in ftp client: /cygdrive/i/home/antor/dance/upload

   upload: 1.jpg     type: image/jpeg     size: 107.9072265625 kb     stored in: c:\windows\temp\php767.tmpupload: 1.jpg     type: image/jpeg     size: 107.9072265625 kb     temp file: c:\windows\temp\php767.tmpstored in: upload/1.jpgupload: 1.jpg     type: image/jpeg     size: 107.9072265625 kb     temp file: c:\windows\temp\php767.tmp     stored in: /cygdrive/i/home/antor/dance/upload/1.jpg  

this code used:

    <form action="upload_file.php" method="post"     enctype="multipart/form-data">     <label for="file">filename:</label>     <input type="file" name="file" id="file"><br>     <input type="submit" name="submit" value="submit">     </form> 

and:

    <?php     if ($_files["file"]["error"] > 0)       {       echo "error: " . $_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 "stored in: " . $_files["file"]["tmp_name"];       }       $allowedexts = array("gif", "jpeg", "jpg", "png");     $extension = end(explode(".", $_files["file"]["name"]));     if ((($_files["file"]["type"] == "image/gif")     || ($_files["file"]["type"] == "image/jpeg")     || ($_files["file"]["type"] == "image/jpg")     || ($_files["file"]["type"] == "image/pjpeg")     || ($_files["file"]["type"] == "image/x-png")     || ($_files["file"]["type"] == "image/png"))     && ($_files["file"]["size"] < 2000000)     && in_array($extension, $allowedexts))       {       if ($_files["file"]["error"] > 0)         {         echo "error: " . $_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 "stored in: " . $_files["file"]["tmp_name"];         }       }     else       {       echo "invalid file";       }         $allowedexts = array("gif", "jpeg", "jpg", "png");     $extension = end(explode(".", $_files["file"]["name"]));     if ((($_files["file"]["type"] == "image/gif")     || ($_files["file"]["type"] == "image/jpeg")     || ($_files["file"]["type"] == "image/jpg")     || ($_files["file"]["type"] == "image/pjpeg")     || ($_files["file"]["type"] == "image/x-png")     || ($_files["file"]["type"] == "image/png"))     && ($_files["file"]["size"] < 2000000)     && in_array($extension, $allowedexts))       {       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"] . " exists. ";           }         else           {           move_uploaded_file($_files["file"]["tmp_name"],           "upload/" . $_files["file"]["name"]);           echo "stored in: " . "upload/" . $_files["file"]["name"];           }         }       }     else       {       echo "invalid file";       }      ?>  

the folder upload below main uploader.php file , has 777 permissions. idea file stored? or better yet, how can put in right directory.

--update update/ folder seems right position. still file not appear, tried on different server well. doing wrong in script? there error check do?

could .htaccess have it? there drupal site on level above dance, has .htaccess:

# # apache/php/drupal settings: #  # protect files , directories prying eyes. <filesmatch "\.(engine|inc|info|install|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|entries.*|repository|root|tag|template|all-wcprops|entries|format)$">   order allow,deny </filesmatch>  # don't show directory listings urls map directory. options -indexes  # follow symbolic links in directory. options +followsymlinks  # make drupal handle 404 errors. errordocument 404 /index.php  # force simple error message requests non-existent favicon.ico. <files favicon.ico>   # there no end quote below, compatibility apache 1.3.   errordocument 404 "the requested file favicon.ico not found. </files>  # set default handler. directoryindex index.php  # override php settings. more in sites/default/settings.php # following cannot changed @ runtime.  # php 4, apache 1. <ifmodule mod_php4.c>   php_value magic_quotes_gpc                0   php_value register_globals                0   php_value session.auto_start              0   php_value mbstring.http_input             pass   php_value mbstring.http_output            pass   php_value mbstring.encoding_translation   0 </ifmodule>  # php 4, apache 2. <ifmodule sapi_apache2.c>   php_value magic_quotes_gpc                0   php_value register_globals                0   php_value session.auto_start              0   php_value mbstring.http_input             pass   php_value mbstring.http_output            pass   php_value mbstring.encoding_translation   0 </ifmodule>  # php 5, apache 1 , 2. <ifmodule mod_php5.c>   php_value magic_quotes_gpc                0   php_value register_globals                0   php_value session.auto_start              0   php_value mbstring.http_input             pass   php_value mbstring.http_output            pass   php_value mbstring.encoding_translation   0 </ifmodule>  # requires mod_expires enabled. <ifmodule mod_expires.c>   # enable expirations.   expiresactive on    # cache files 2 weeks after access (a).   expiresdefault a1209600    # not cache dynamically generated pages.   expiresbytype text/html a1 </ifmodule>  # various rewrite rules. <ifmodule mod_rewrite.c>   rewriteengine on    # if site can accessed both , without 'www.' prefix,   # can use 1 of following settings redirect users preferred   # url, either or without 'www.' prefix. choose 1 option:   #   # redirect users access site 'www.' prefix,   # (http://example.com/... redirected http://www.example.com/...)   # adapt , uncomment following:   # rewritecond %{http_host} ^example\.com$ [nc]   # rewriterule ^(.*)$ http://www.example.com/$1 [l,r=301]   #   # redirect users access site without 'www.' prefix,   # (http://www.example.com/... redirected http://example.com/...)   # uncomment , adapt following:   # rewritecond %{http_host} ^www\.example\.com$ [nc]   # rewriterule ^(.*)$ http://example.com/$1 [l,r=301]    # modify rewritebase if using drupal in subdirectory or in   # virtualdocumentroot , rewrite rules not working properly.   # example if site @ http://example.com/drupal uncomment ,   # modify following line:   # rewritebase /drupal   #   # if site running in virtualdocumentroot @ http://example.com/,   # uncomment following line:   # rewritebase /    # rewrite urls of form 'x' form 'index.php?q=x'.   rewritecond %{request_filename} !-f   rewritecond %{request_filename} !-d   rewritecond %{request_uri} !=/favicon.ico   rewriterule ^(.*)$ index.php?q=$1 [l,qsa] </ifmodule>  # $id: .htaccess,v 1.90.2.3 2008/12/10 20:04:08 goba exp $ 

if folder below .php file,

 move_uploaded_file($_files["file"]["tmp_name"],   "upload/" . $_files["file"]["name"]); 

is trying upload 'upload' directory on same level file running from.

try

move_uploaded_file($_files["file"]["tmp_name"],   "../upload/" . $_files["file"]["name"]); 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -