<div id="uploadform">
<script>
function send() {
javascript: location = 'upload.asp?hqtp=sent';
}
</script>
<h3><span>SEND YOUR PHOTO</span></h3>
<fieldset><legend>Send Your Photo</legend>
<p class="first">
<input placeholder="Write Your Name" type="text" name="name" id="name" size="30" />
</p>
<p>
<input placeholder="Write Your Email" type="text" name="email" id="email" size="30" />
</p>
<p>
<input placeholder="Write Photo's Country" type="text" name="country" id="country" size="30" />
</p>
<p>
<input placeholder="Write Photo's City" type="text" name="city" id="city" size="30" />
</p>
<p>
<button id="choosebutton" onClick="document.querySelector('input#button22').click()">CHOOSE A PHOTO</button>
<input id="button22" style="visibility: collapse; width: 0px;" type="file" onChange="upload(this.files[0])">
</p>
<script>
window.ondragover = function(e) {e.preventDefault()}
window.ondrop = function(e) {e.preventDefault(); upload(e.dataTransfer.files[0]); }
function upload(file) {
if (!file || !file.type.match(/image.*/)) return;
document.body.className = "uploading";
/* Lets build a FormData object*/
var fd = new FormData(); // I wrote about it: https://hacks.mozilla.org/2011/01/how-to-develop-a-html5-image-uploader/
fd.append("image", file); // Append the file
fd.append("key", "6528448c258cff474ca9701c5bab6927"); // Get your own key http://api.imgur.com/
var xhr = new XMLHttpRequest(); // Create the XHR (Cross-Domain XHR FTW!!!) Thank you sooooo much imgur.com
xhr.open("POST", "http://api.imgur.com/2/upload.json"); // Boooom!
xhr.onload = function() {
// Big win!
document.querySelector("#link").value = JSON.parse(xhr.responseText).upload.links.imgur_page;
document.body.className = "uploaded";
}
xhr.send(fd);
}
</script>
<style>
#link, #uploadingbarr , #uploadbutton1 {display: none}
#uploadbutton1 {display: inline-block;}
.uploading #uploadingbarr {display: inline}
.uploaded #link {display: inline}
</style>
<p id="uploadingbarr"><img src="images/uploading.gif" /></p>
<input name="resimurl" readonly="readonly" type="text" id="link" size="35" >
<p class="submit"><button id="sendbutton" onClick="send();" type="submit">Send Your Photo</button></p>
</fieldset>
</div> upload edilen dosyanın uzantısını öğrenme
0
●387
- 11-02-2014, 01:03:14arkadaşlar şöyle bir form hazırladım. upload kısmını bir scriptten aldım da burada ben upload edilen dosyanın uzantısını nasıl öğrenebilirim acaba?