Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

phpÉÏÔØÎļþÖ»Äܱ£´æһС²¿·Ö

<html>
<head>
  <title>Uploading...</title>
</head>
<body>
<h1>Uploading file...</h1>
<?php
    echo '<pre>';
    print_r($_FILES);
    echo '</pre>';
    if ($_FILES['userfile']['error'] > 0)
        {
          echo 'Prolem: ';
          switch ($_FILES['userfile']['error'])
          {
            case 1: echo 'File exceeded upload_max_filesize'; break;
            case 2: echo 'File exceeded max_file_size'; break;
            case 3: echo 'File only partially uploaded'; break;
            case 4: echo 'No file uploaded'; break;
          }
          exit;
}
    if ($_FILES['userfile']['type'] != 'application/x-zip-compressed')
        {
           echo 'Problem: file is not pdf';
           exit;
       }
    $upfile = '/upload/'.$_FILES['userfile']['name'];
     if (is_uploaded_file($_FILES['userfile']['tmp_name']))
        {   
     if (!move_uploaded_file($_FILES['userfile']['tmp_name'], $upfile))
          {
           echo 'Problem: Could not move file to destination directory';
            exit;
    &nb


Ïà¹ØÎĵµ£º

PHP¼ì²âÉÏ´«ÎļþµÄÀàÐÍ

תÔØ×Ô£ºhttp://hi.baidu.com/thinkinginlamp/blog/item/5da6905211f719050df3e356.html
×÷ÕߣºÀÏÍõ
×îÀõķ½·¨¾ÍÊÇͨ¹ý$_FILES[...]['type']À´¼ì²âÉÏ´«ÎļþµÄÀàÐÍ£¬ÒòΪֻÐè¼òµ¥ÐÞ¸ÄÎļþÀ©Õ¹Ãû¾Í¿ÉÒÔαÔìËü¡£
ÁíÒ»¸öÏà¶Ô°²È«µãµÄ·½·¨ÊÇͨ¹ýÎļþÍ·Á½¸ö×Ö½ÚµÄÄÚÈÝÀ´ÅжÏÉÏ´«ÎļþµÄÀàÐÍ£¬Àý×Ó´úÂëÈçÏ£º
01 $handle = fop ......

PHPÍøÒ³UTF8±àÂ뿪·¢Öпհ׵ÄÎÊÌâ

¿ª·¢ÖÐһֱû°ì·¨½â¾öµÄÒ»¸öÎÊÌâ
¡¡¡¡Ò³Ãæ²ÉÓÃUTF8±àÂ룬ͷ²¿ºÍβ²¿ÓÃÁËÄ£°å°üº¬ÎļþµÄ·½·¨£¬½á¹ûÍ·²¿ºÍβ²¿Î޶˶˸÷¶à³öÒ»¸öÔ¼10pxµÄ¿Õ
ÐУ¬Ê²Ã´Ò²Ã»ÓС£
¡¡¡¡Ô­ÒòÊÇÈ«²¿²ÉÓÃutf8±àÂ룬°üº¬ÎļþµÄʱºò£¬×îºóµÄ¶þ½øÖÆÁ÷Öаüº¬Á˶à´ÎUTF8
BOM±ê¼Ç£¬IE²»ÄÜÕý³£½âÎö°üº¬¶à¸öUTF8 BOM ±ê¼ÇµÄÒ³Ã棬ֱ½ÓÌæ»»³Éʵ¼ÊÏÔʾµÄ»Ø³ ......

phpͼƬÉÏ´«ÐĵÃ

ÔÚphpÖвâÊÔµ¥¸öÎļþÉÏ´«ºÍÔÚÍøÉÏä¯ÀÀÁ˺ܶà¹ØÓÚ¶àÎļþÉϴ棬´ó¶à¶¼ÊDz¶àÒ»ÑùµÄ¡£Ö»ÊÇÉÏ´«¶à¸öÎļþÓÃpost´«µÝʱÊÇÊý×é´«µÝ£¬Èç<input type="file" name="pic[]" id="pic">¶øµ¥¸öÎļûÉÏ´«<input type="file" name="pic" id="pic">¡£
Ìá½»Êý¾Ýʱ£¬¶à¸öÎļþÓÃforeach À´Ñ­»·£¬ÆäËûÏÞÖƺ͵¥¸öÎļþÉÏ´«¶¼ÊÇ ......

ΪÄãÆʽâPHPÐòÁл¯¸ñʽ

¶ÔÓÚÄÇЩ¸Õ¸Õ½Ó´¥PHPÓïÑÔµÄÅóÓÑÀ´Ëµ£¬Ê²Ã´ÊÇPHPÐòÁл¯¸ñʽ¿ÉÄÜ´ó¼Ò¶¼»¹ÊDz»Ì«Çå³þ¡£ÎÒÃǽñÌì¾ÍΪ´ó¼ÒÏêϸ½²½âÕâÒ»·½ÃæµÄ֪ʶ¡£
PHP £¨´Ó PHP 3.05 ¿ªÊ¼£©Îª±£´æ¶ÔÏóÌṩÁËÒ»×éÐòÁл¯ºÍ·´ÐòÁл¯µÄº¯Êý£ºserialize¡¢unserialize¡£²»¹ýÔÚ PHP ÊÖ²áÖжÔÕâÁ½¸öº¯ÊýµÄ˵Ã÷½öÏÞÓÚÈçºÎʹÓ㬶ø¶ÔÐòÁл¯½á¹ûµÄ¸ñʽȴû×öÈκÎ˵Ã÷¡£ ......

php¼ÓÈëlinuxϵͳÃüÁî


¼ÙÉèphp°²×°ÔÚ/usr/local/php5/bin/php£¬³õʼÔÚÃüÁîÐÐÖ´ÐÐPHPµÄʱºòÒªÊäÈëÒ»³¤´®µÄ·¾¶£¬eg£º
$>/usr/local/php5/bin/php phpinfo.php
·Ç³£µÄÂé·³£¬ÏÖÔÚÖ»Ð轫php¿½±´ÖÁusr/sbinĿ¼¼´¿ÉÖ±½ÓʹÓÃphpÃüÁeg£º
$>cp /usr/local/php5/bin/php /usr/sbin/
$>php phpinfo.php
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ