Created
August 18, 2014 19:17
-
-
Save ffflabs/7bd9b9df91bb108f10c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> | |
<script> | |
function removeFile() | |
{ | |
var input = document.getElementById("fileToUpload"); | |
input.value = input.defaultValue; | |
refreshForm(); | |
return false; | |
} | |
function refreshForm() | |
{ | |
var input = document.getElementById("fileToUpload"); | |
if (input.files.length > 0) | |
{ | |
console.log('set visible'); | |
$("#upack-form > #remove-lnk").css("visibility", "visible"); | |
} | |
else | |
{ | |
console.log('set hidden'); | |
$("#upack-form > #remove-lnk").css("visibility", "hidden"); | |
} | |
} | |
</script> | |
<div class="package"> | |
<form id="upack-form" action="/update_package" enctype="multipart/form-data" method="post"> | |
<label> | |
<input id="fileToUpload" type="file" name="file" style="width: 280px; overflow: hidden;" single onChange="refreshForm();" /> | |
| |
</label> | |
<a id="remove-lnk" style="visibility: hidden;" onclick="return removeFile();">remove</a> | |
</form> | |
</div> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment