[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

JavaScript and AngularJs :how to set path or creating dynamic folder/directory to store uploaded images in javascript

learningtech89

6/2/2015 12:05:00 PM

hello guys,

Novice in Jscrip, am trying to store uploaded image files in my any of local drive, plus it should be lied in dynamically created folder.

like:
parentFolder-->childFolder-->img.jepg/png

Ex: UserUploads-->Customer!-->img.jpeg/png.

if i run below code, its just show uploaded image name next to choose file icon,

if i click upload button, it has shows me directories dynamically..!!!

could any tell me what's wrong here, hope anyone of you people help me complete this code..


thanks in advance.

<!DOCTYPE html>

<html>
<head>



<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript">
var upload = function() {
var photo = document.getElementById("photo");
var file = photo.files[0];

console.log("File name: " + file.fileName);
console.log("File size: " + file.fileSize);
console.log("Binary content: " + file.getAsBinary());
console.log("Text content: " + file.getAsText(""));

var preview = document.getElementById("preview");
preview.src = file.getAsDataURL();

return false;
};

</script>
</head>
<body>

<form action="/" method="post" onsubmit="return upload();">

Upload photo
<input type="file" name="photo" id="photo">
<input type="submit" value="Upload">
<hr>
<img src="" alt="Image preview" id="preview">

</form>

</body>
</html>