Trying to append a hidden form field after the file input that was used to upload a file within the simpleUpload call.
So far I have tried:
$(document).on('change', '.upfile', function(){
var obj = $(this);
$(this).simpleUpload("/upload.php", {
start: function(file){ console.log("upload started"); },
progress: function(progress){ console.log("upload progress: " + Math.round(progress) + "%"); },
success: function(data){
$(obj).append('<input type="text" name="images[]" value="'+data.message+'">');
console.log("upload successful!");
console.log(data);
},
error: function(error){ console.log("upload error: " + error.name + ": " + error.message); }
});
});
$(document).on('change', '.upfile', function(){
var obj = this;
$(this).simpleUpload("/upload.php", {
start: function(file){ console.log("upload started"); },
progress: function(progress){ console.log("upload progress: " + Math.round(progress) + "%"); },
success: function(data){
$(obj).append('<input type="text" name="images[]" value="'+data.message+'">');
console.log("upload successful!");
console.log(data);
},
error: function(error){ console.log("upload error: " + error.name + ": " + error.message); }
});
});
To no avail. There seems to be no way of setting a context: in simpleUpload or I would have tried that.
What am I doing wrong?