Results 1 to 6 of 6

Thread: PHP

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User zombie13's Avatar
    Join Date: Oct:2012
    Location: Bulgaria - Ruse
    Posts: 63

    PHP

    ,

    .

    HTML Code:
    <form enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <label for="avatar">Choose an avatar:</label>
    <input type="file" id="avatar" name="avatar" />
    <input type="submit" name="submit" value="Submit" />
    </form>
    
    png,jpg,gif if . pdf . Else var_dump .


    PHP Code:

    if(isset($_POST['submit'])){
            
    $avatar $_FILES['avatar']['name'];
            
    $avatar_type $_FILES['avatar']['type'];

            
    // var_dump($avatar_type);

            
    if($avatar_type == 'image/gif' || $avatar_type=='image/png' || $avatar_type=='image/jpg'){
                echo 
    'Supported format';
            }else{
                echo 
    'Not supported format';
            }
        } 
    Submit, .

    , .

  2. #2
    Registered User
    Join Date: Nov:2008
    Location: Sofia
    Posts: 97

  3. #3
    Registered User zombie13's Avatar
    Join Date: Oct:2012
    Location: Bulgaria - Ruse
    Posts: 63
    , , , pdf 10 var_dump($avatar_type) , pdf e 10 var_dump($avatar_type) string '' (length=0).

  4. #4
    Deleted User 4eRNoBiL's Avatar
    Join Date: Oct:2005
    Location:
    Posts: 739
    , . - . php.ini post_max_size upload_max_filesize.
    Fujistu Lifebook E756 | Core i7-6500U / 400MHz-3.1GHz | 8 GB DDR4-2133 | Samsung PM871 / 256 GB SSD | 15" 1920x1080 | Manjaro Linux + kernel 4.19

  5. #5
    Registered User
    Join Date: Nov:2008
    Location: Sofia
    Posts: 97
    , type , type( ). 10 100% , 10 .

    :
    http://davidwalsh.name/php-file-extension

  6. #6
    Registered User
    Join Date: Jul:2005
    Location: Sofiq
    Posts: 2,798
    . IE . http://php.net/manual/en/function.finfo-file.php . , (Nginx, Apache, ...) PHP php.ini.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |