Image Upload

if($_FILES[“video”][“name”]){
$dir = __DIR__;
$uploaded_dir = $dir.”/uploads/feedback/”;
$video = $_FILES[“video”][“name”];
$path = $uploaded_dir . $video;
move_uploaded_file($_FILES[“video”][“tmp_name”], $path);
}

 

 

<li class=”photograph”>
<input type=”text” placeholder=”Share your Photograph” value=”” id=”filename”>
<input type=”file” onchange=”uploadimage(this.value);” name=”profileimage” id=”profileimage”>
<label for=”profileimage”>Upload</label>

</li>

 

function uploadimage(filename){
var ext = filename.split(‘.’).pop();
if($.inArray(ext, [‘jpg’,’png’,’jpeg’]) == -1) {
alert(‘Invalid file!’);
this.value = ”;
return false;
}
file = filename.split(‘\\’);
document.getElementById(‘filename’).value = file[file.length – 1];
}

Advertisements