1
0
Fork 0

Add a text box for holding the file name that the upload was stored as on the server.

This commit is contained in:
Andrew Tomaka 2011-11-02 14:41:40 -04:00
parent 898337c033
commit f4d271afb2
2 changed files with 6 additions and 3 deletions

View file

@ -7,12 +7,12 @@ $(function(){
paramname:'image', paramname:'image',
maxfiles: 5, maxfiles: 5,
queuefiles: 1,
maxfilesize: 10, maxfilesize: 10,
url: 'upload.php', url: 'upload.php',
uploadFinished:function(i,file,response){ uploadFinished:function(i,file,response){
$.data(file).addClass('done'); $.data(file).addClass('done');
$.data(file).find('.linkBox').val(response.file);
// response is the JSON object that post_file.php returns // response is the JSON object that post_file.php returns
}, },
@ -61,13 +61,16 @@ $(function(){
'<div class="progressHolder">' + '<div class="progressHolder">' +
'<div class="progress"></div>' + '<div class="progress"></div>' +
'</div>' + '</div>' +
'<div class="linkHolder">' +
'<input type="text" class="linkBox" />' +
'</div>' +
'</div>'; '</div>';
function createImage(file){ function createImage(file){
var preview = $(template), var preview = $(template),
image = $('img', preview); image = $('img', preview);
var reader = new FileReader(); var reader = new FileReader();

View file

@ -17,5 +17,5 @@ if(array_key_exists('image', $_FILES)) {
move_uploaded_file($file['tmp_name'], UPLOADS . $file['name']); move_uploaded_file($file['tmp_name'], UPLOADS . $file['name']);
} }
echo json_encode(array('status'=>'Uploaded successfully')); echo json_encode(array('status'=>'Uploaded successfully','file'=>'http://screens.p5dev.com/' . UPLOADS . $file['name']));
?> ?>