我正在使用Lightbox Evolution:
http://codecanyon.net/item/jquery-lightbox-evolution/115655
在单击图像时打开灯箱。灯箱包含<input type="file" />
标记。标签可以完全独立工作,但是当在灯箱内时,.php文件不会收到$_FILES
参数。
的index.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>
upload.php的
<?php
if(isset($_FILES["uploadFiles"]))
{
echo '<img src="'.$theImage.'" class="preview">';
}
?>