dousi4900 2010-09-06 05:24
浏览 55
已采纳

在WordPress模板中实现uploadify?

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. Therefore, I want to use uploadify. I have to set that up in WordPress.

What I've done 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 WordPress 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 ideas?

  • 写回答

3条回答 默认 最新

  • donglei3370 2010-09-06 06:26
    关注

    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!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?