views:

491

answers:

2

I am using 'Uploadify' JQuery plugin for file upload. I read the documentation and referred examples and attached the code in my file. Everything works well except that after uploading the file, the file name just disappears. You can find the documentation here.

The documentation says about "onComplete" option, but I am not following how to implement below:

<input id="btnBrowse" name="btnBrowse" type="button" value="Browse"/>
            <script type="text/javascript">// <![CDATA[
                $(document).ready(function() {
                $('#btnBrowse').uploadify({
                'uploader'  : '../Lib/uploadify.swf',
                'script'    : '../Lib/uploadify.php',
                'cancelImg' : '../Lib/cancel.png',
                'auto'      : true,
                'folder'    : '../../upload'
                });
                });
            // ]]></script>

I also want to show the message that file successfully uploaded.

Please assist.

+4  A: 

http://www.uploadify.com/forum/viewtopic.php?f=7&amp;t=58

in your case:

<script type="text/javascript">// <![CDATA[
$(document).ready(function() {
$('#btnBrowse').uploadify({
'uploader'  : '../Lib/uploadify.swf',
'script'    : '../Lib/uploadify.php',
'cancelImg' : '../Lib/cancel.png',
'auto'      : true,
'folder'    : '../../upload',
'onComplete': function(event, queueID, fileObj, reposnse, data) {
     //Do something here using the parameters as they defined in the docs
 }
});
});
// ]]></script>
yn2
Ok, thanks. I also want to keep showing the uploaded file's name there.
RPK
A: 

If you want to show the filename of what was uploaded, you can either access the file object, which has properties such as the file name, path and size, or manipulate the response your uploader script returns to include the details of the file you want.

Bear in mind that the the file object only contains what you submitted, not what was actually written to the server, so if your uploader does any file name manipulation (to deal with duplicates), then you'll need to return the correct file details in the response and use that instead.

Hope that helps!

Dano

Dano