English 中文(简体)
php在确认形式回报不实时保留地的价值
原标题:php keep the value of file fields when validating a form returns false

Im与 y二框架表格合作,我采取这样的形式:

<?php echo CHtml::beginForm(  ,  post , array( enctype  =>  multipart/form-data )); ?>
    Image:<?php echo CHtml::activeFileField($model,  image );?>
          <?php echo CHtml::error($model,  image );?>

    Full name: <?php echo CHtml::activeTextField($model,  fullName );?>
               <?php echo CHtml::error($model, fullName ); ?>
   <?php echo CHtml::submitButton( save);?>
<?php echo CHtml::endForm();?>

如果用户投入出现错误,档案现场就变得空洞,用户必须重新展示其形象。 是否有办法将档案的实地价值保存在Nyii或php?

预 收

最佳回答

简短回答: 无

文档投入依靠用户的当地档案系统,服务器(因此PHP)对此无所知。 因此,所提交的表格中,用户必须重选档案。 这比任何其他问题都更是一个安全问题。

在这方面,可以采取两种办法改进未爆弹药:

  • The file will have been successfully uploaded, so you could keep it on the server and use your copy when the form is resubmitted (hard to implement, potentially confusing to the user and generally not recommended)
  • (better) You could validate the form entry client side with Javascript - or server side via AJAX - before it is submitted. If you do this, you should still validate server-side, but it will help give legitimate users a better user experience, which seems to be what you are bothered about here.
问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签