我正在使用 Lightbox Evolution:
http://codecanyon.net/item/jquery-lightbox-evolution/115655
单击图像时打开灯箱。灯箱包含一个<input type="file" />
标签。该标签本身可以完美运行,但在灯箱内时,.php 文件不会接收$_FILES
参数。
索引.html
<script>
$('#uploadFiles').live('change', function(event){
$("#preview").html('');
$("#preview").html('<img src="images/spinner.gif" title="Uploading..."/>');
$("#imageform").ajaxForm({
target: '#preview'
}).submit();
});
</script>
<div id='left-picture'>
<a href="lightbox[width]=524&lightbox[height]=178#form-id" class="lightbox">
<div id="preview">
<img src="images/default_profile_image.jpg" width="192" height="225" />;
</div>
</a>
<div id="form-id" style="display:none;">
<form id="imageform" method="post" enctype="multipart/form-data" action="up.php">
<input type="file" name="uploadFiles[]" id="uploadFiles" />
</form>
<script type='text/javascript'>
</script>
</div>
</div>
上传.php
<?php
if(isset($_FILES["uploadFiles"]))
{
echo '<img src="'.$theImage.'" class="preview">';
}
?>