From f4d271afb22af049dec36a73a191cd2f94ac0d79 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Wed, 2 Nov 2011 14:41:40 -0400 Subject: [PATCH] Add a text box for holding the file name that the upload was stored as on the server. --- js/upload.js | 7 +++++-- upload.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/js/upload.js b/js/upload.js index 9aaa077..c0a8cc6 100644 --- a/js/upload.js +++ b/js/upload.js @@ -7,12 +7,12 @@ $(function(){ paramname:'image', maxfiles: 5, - queuefiles: 1, maxfilesize: 10, url: 'upload.php', uploadFinished:function(i,file,response){ $.data(file).addClass('done'); + $.data(file).find('.linkBox').val(response.file); // response is the JSON object that post_file.php returns }, @@ -61,13 +61,16 @@ $(function(){ '
' + '
' + '
' + + '
' + + '' + + '
' + ''; function createImage(file){ var preview = $(template), - image = $('img', preview); + image = $('img', preview); var reader = new FileReader(); diff --git a/upload.php b/upload.php index 3dae520..df52917 100644 --- a/upload.php +++ b/upload.php @@ -17,5 +17,5 @@ if(array_key_exists('image', $_FILES)) { 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'])); ?> \ No newline at end of file