Validation uploadify
I am using jQuery Uploadify to upload files to my site. How can I tell if a user has selected a file or not? I tried using the folder object value of the Uploa开发者_如何转开发dify object but its not working for me--it's always the same. I assume that it was null before it was selected.
How can I tell that a user has selected a file?
You could try something like this:
<script type="text/javascript">
var selected = false;
$(document).ready(function() {
$('#fileInput').uploadify({
'uploader' : 'uploadify.swf',
'script' : 'uploadify.php',
'cancelImg' : 'cancel.png',
'auto' : true,
'folder' : '/uploads',
'onSelect' : function() { selected = true; },
'onCancel' : function() { selected = false; }
});
});
</script>
Then you can test if 'selected' is true/false.
精彩评论