arkadaşlar saatlerdir uğraşıyorum bir türlü anlayamadım problemin nerede olduğunu. site içindeki kod şu;
<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>
<div><button onClick="document.querySelector('input').click()">UPLOAD PHOTO</button></div>
<input style="visibility: collapse; width: 0px;" type="file" onChange="upload(this.files[0])">
<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>
<p>Uploading...</p>
<input name="resimurl" readonly="readonly" type="text" id="link" size="35" >
</p>
<p class="submit"><button onclick="send();" type="submit">Send Your Photo</button></p>
</fieldset>
</div>bu da upload sistemini tek başına kullandığım kod;
<div>
<script>
function send() {
javascript: location = 'upload.asp';
}
</script>
<div><button onClick="document.querySelector('input').click()">UPLOAD PHOTO</button></div>
<input style="visibility: collapse; width: 0px;" type="file" onChange="upload(this.files[0])">
<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, p , #uploadbutton1 {display: none}
#uploadbutton1 {display: inline-block;}
.uploading p {display: inline}
.uploaded #link {display: inline}
</style>
<p>Uploading...</p>
<input name="resimurl" readonly="readonly" type="text" id="link" size="35" >
<label>
<input onclick="send();" type="submit" name="button" id="button" value="SEND" />
</label>
</div>ilk verdiğim kodda dosya seçmiyor. ikinciyle arasındaki farkı anlayamadım bir türlü. 2. kodu alıp aynen yapıştırıyorum yine olmuyor.