 |
|
Code (JavaScript)
<script>
function handleFileSelect(evt) {
evt.stopPropagation();
evt.preventDefault();
var files = evt.dataTransfer.files; // FileList object.
// files is a FileList of File objects. List some properties.
var output = [];
for (var i = 0, f; f = files[i]; i++)
{
// Only process image files.
if (!f.type.match('image.*'))
{
continue;
}
var reader = new FileReader();
// Closure to capture the file information.
reader.onload = (function(theFile)
{
return function(e)
{
var span = document.createElement('span');
span.innerHTML = ['<img class="thumb" width="80" heigh="70" src="', e.target.result,
'" title="', escape(theFile.name), '"/> ',escape(theFile.name),'(',theFile.type || 'n/a',') - ',theFile.size,' bytes <br>'].join('');
document.getElementById('list').insertBefore(span, null);
};
})(f);
// Read in the image file as a data URL.
reader.readAsDataURL(f);
}
}
function handleDragOver(evt) {
evt.stopPropagation();
evt.preventDefault();
evt.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
}
// Setup the dnd listeners.
var dropZone = document.getElementById('drop_zone');
dropZone.addEventListener('dragover', handleDragOver, false);
dropZone.addEventListener('drop', handleFileSelect, false);
</script>
คือผมมีโค้ดหน้าตาแบบนี้ครับ แต่ว่าผมต้องการที่จะเก็บค่าต่างๆของรูปลงไปใน database ผมจะต้องทำยังไง หรือ ส่งค่าไปให้ php ยังไงครับ
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2012-03-29 14:14:46 |
By :
tenichi |
View :
3317 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |