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

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.


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>


<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;


<form action="/" method="post" onsubmit="return upload();">
 Upload photo
    <input type="file" name="photo" id="photo">
    <input type="submit" value="Upload">
    <img src="" alt="Image preview" id="preview">

6/2/2015 12:05:00 PM
comp.lang.javascript 38370 articles. 2 followers. javascript4 (1315) is leader. Post Follow

0 Replies

Similar Articles

[PageSpeed] 30