小编php*_*eak的帖子

是否可以在上传之前显示tmp文件夹中的图像?

我想在用户将图像上传到服务器之前向用户显示图像,以确保该图像是用户想要上传的图像.

我已经尝试过这样做$_FILES['name']['tmp_name']并把它放在标签中,但没有任何反应.

 <form action='' method='POST'  enctype="multipart/form-data">
        <header class='pageHeading'>Kop afbeedling toevoegen</header>            
        <section class='body'>               
            <div class='inputFrame'>  


                <img src="<?php if(isset($_FILES['image']['tmp_name'])){echo $_FILES['image']['name'];}?>"/>

                        <div class='input'>
                            <div class="cellFrame">
                                <div class="inputHeading">Afbeelding uploaden</div>
                                <div class="frame">
                                    <div class="frameAlign">
                                        <div class="displayFlie">
                                            <input type='file' name='image'/>
                                        </div>
                                        <button name='upload' class='btnUpload btn'>Upload</button>
                                        <div class="clr"></div>
                                    </div>
                                </div>
                            </div>
                        </div>



                <div class="clr"></div>   
            </div>
         </form>
Run Code Online (Sandbox Code Playgroud)

php upload file tmp

4
推荐指数
2
解决办法
8627
查看次数

文本区域空白

每次我更新表单文本区域时,表单都会添加一个空格。这是一个问题,因为我使用文本区域输入为用户使用的每个新行创建一个新的数组元素。

HTML:

<textarea class='form-control input-lg' name='stout' style='width:100%;min-height:200px;resize: none; '> 
     <?php $a = $functie-  >_getFileContent('../content/stout.txt', 'j');
     echo $bewerking->_extraInfoInput($a);?>
</textarea>
Run Code Online (Sandbox Code Playgroud)

功能:

public function _extraInfoInput($a){
    $a = preg_replace('/ /', '', $a);

    return $a;
}

 public function _getFileContent($file,$uitzondering){       
   $content = file_get_contents($file);        
   if($content != ''){
       if($uitzondering == ''){
           $a = $content.'<br/>';
       }
       else{

           $a = $content;

       }
       return $a;
   }  
Run Code Online (Sandbox Code Playgroud)

}

html php whitespace textarea

1
推荐指数
1
解决办法
1434
查看次数

标签 统计

php ×2

file ×1

html ×1

textarea ×1

tmp ×1

upload ×1

whitespace ×1