Upload Script
Upload Script
Hello,
I have the following Upload-Script where show the image after the upload. Then I have a delete button where delete the image. When I upload know a new image, the image is on the ftp-server, but the script shows me the old image. Who can help me?
- new AjaxUpload(btnUpload1, {
action: 'upload-file.php?id=<?php echo $id; ?>&name=portrait',
name: 'uploadfile',
onSubmit: function(file, ext){
if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){
// extension is not allowed
status1.text('Only JPG, PNG or GIF files are allowed');
return false;
}
status1.html('<img src="loader.gif" width="32px" height="32px" style="position: relative; top: 0px; left: 0px; z-index: 100;>');
},
onComplete: function(file, response){
//On completion clear the status
status1.text('');
$("#upload1").hide("slow");
$("#delete1").show("slow");
$("#files1").show("slow");
//Add uploaded file to list
if(response==="success"){
$('<li></li>').appendTo('#files1').html('<img src="<?php echo "uploads/".$id."-portrait_".$guid.".jpg"; ?>" alt="" /><br />').addClass('success');
} else{
$('<li></li>').appendTo('#files1').html('<img src="<?php echo "uploads/".$id."-portrait_".$guid.".jpg"; ?>" alt="" width="100px" /><br />').addClass('success');
$('#delete1').click(function() {
$("#upload1").show("slow");
$("#delete1").hide("slow");
$("#files1").empty("slow");
});
}
}
});
Thanks.
Regards
Benny