views:

86

answers:

2

hey guys, it's my first time using uploadify and i'm trying to implement it into a wordpress page template.

I have a template which should users of my website allow to upload files (or more files at once) to a specific folder on my ftp-server. I want to use uploadify therefore.

I really need your help, because i have no idea how i have to set that up in wordpress.

What i did so far:

  1. i downloaded the uploadify package (latest version)
  2. renamed the folder it to "uploadify" so it's easier to call the package
  3. uploaded the uploadify folder into my template directory
  4. opened my custom page-template with the name ftp-upload.php
  5. added two script-tags under get_header()
  6. added the javascript to call uploadify

just so you know, my whole wordpres blog already uses jQuery so it's already embedded in my header file.

<?php
/*
Template Name: ftpupload
*/
?>
<?php get_header(); ?>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/uploadify/swfobject.js"
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/uploadify/jquery.uploadify.v2.1.0.min.js"></script>

<script type="text/javascript">
$(document).ready(function() {
    $('#fileselect').uploadify({
        'uploader': '<?php bloginfo('template_url'); ?>/uploadify/uploadify.swf',
        'script': '<?php bloginfo('template_url'); ?>/uploadify/uploadify.php',
        'folder': '/userupload',
        'cancelImg': '<?php bloginfo('template_url'); ?>/uploadify/cancel.png'
    });
});

</script>

    <div id="content">
            <?php if(!isset($_POST['sendit'])){ ?> 
            <form id="formUpload" name="form" action="<? $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">

                <input id="fileselect" type="file" name="userfile" class="loginInput"/>

the folder i want to upload the files to is in my root directory on my server called "userupload".

currently my browser tells me that: ERROR: $("#fileselect").uploadify is not a function

any idea what i need to do?

+1  A: 

Are you sure the files get included corectly? It would seem it doesnt see the uploadify js file. Also it would be nice you accepted my answer to your other question it got you here :-)

Oh wait you are not closing the frst script tag!

<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/uploadify/swfobject.js" ></script>

That should fix THAT problem!

Iznogood
that's true!! thank you i forgot to close the tag, wouldn't work anyway until i tried kitsched's solution.
could it be, that /userupload as folder in my root could not work?
Well does it escist at that place and are the permissions right for the folder?
Iznogood
yeah the folder exists, in my root of my server, even if i create a userupload folder in my template_directory and link to it, the uploads do not start!!! permissions are set (777) ... i can select multiple files and everything seems to work, except for the fact that nothing uploads, the progress bar is not showing. i can cancel the selected uploads, but it doesn't start in the first place.
+2  A: 

Be sure to include jQuery and the plug-in's .js files.

Also, it could be that your $ shortcut isn't defined. Try jQuery('#fileselect').

kitsched
thank you, it at least loads the browse button and the the whole component! yeah!! however it does not really work! when i select a file it doesn't show the upload progress, just the little red X