点击f5后如何防止重新提交
我想在上传后阻止 f5 php
header();
我试着include '';
但不工作!
任何解决方案?
我的表格
<form id="pic-form" enctype="multipart/form-data" action="pic.php" method="POST">
<input name="uploadedfile" id="pic-upload" type="file"/>
<input type="submit" value="upload" id="submit" name="submit"/>
</form>
我的PHP代码
<? include 'var.php';
if(isset($_POST['submit']) and $_SERVER['REQUEST_METHOD'] == "POST"){
if($terms == 'yes'){
if ((($_FILES["uploadedfile"]["type"] == "image/jpeg")
|| ($_FILES["uploadedfile"]["type"] == "image/jpg")
|| ($_FILES["uploadedfile"]["type"] == "image/x-png")
|| ($_FILES["uploadedfile"]["type"] == "image/gif")
|| ($_FILES["uploadedfile"]["type"] == "image/png"))
&& ($_FILES["uploadedfile"]["size"] < $max_file_size)
&& in_array($extension, $formats))
{
move_uploaded_file($_FILES["uploadedfile"]["tmp_name"],
$uploaded );
echo '<img src="'.$url.$uploaded.'"/>';
echo '<h3>'.$url.$short.'</h3>';
}
elseif(!empty ($_FILES["uploadedfile"]["error"])){
echo '<h3>Please choose file to upload it!</h3>'; // if you don't choose file
}
elseif(!in_array($extension, $formats)){
echo '<h3>This extension is not allowed!</h3>'; // if you choose file not allowed
}
elseif($_FILES["uploadedfile"]["size"] = $max_file_size ){
echo "Big size!"; // if you choose big file
}
}
}
?>