本文介绍了在WordPress模板中实现uploadify?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个模板,应该是我的网站的用户允许使用uploadify,我试图实现它到一个WordPress页面模板。上传文件(或一次更多的文件)到我的FTP服务器上的特定文件夹。所以我想用uploadify。



到目前为止,我已经做了:


  1. 我下载了uploadify软件包(最新版本)

  2. 将文件夹重新命名为uploadify,以便于调用软件包
  3. 将uploadify文件夹上载到我的模板目录中
  4. 打开名为ftp-upload.php的自定义页面模板
  5. 添加了两个脚本标签 get_header()

  6. 添加JavaScript以调用uploadify

你知道,我的整个WordPress博客已经使用了jQuery,所以它已经嵌入到我的头文件中了。

 <?php 
/ *
模板名称:ftpupload
* /
?>
<?php get_header(); ?>

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

< / script>

< div id =content>
< form id =formUploadname =formaction =< ;? $ _SERVER ['PHP_SELF'];?> method =postenctype =multipart / form-data>

< input id =fileselecttype =filename =userfileclass =loginInput/>

我要上传文件的文件夹位于服务器的根目录下,名称为userupload 。

目前我的浏览器告诉我:

 错误:$ (#fileselect)。uploadify不是一个函数

有什么想法?

解决方案

你确定这些文件包含corectly吗?它似乎没有看到uploadify js文件。
另外它会很好,你接受我的回答你的其他问题,它让你在这里: - )

等待你没有关闭第一个脚本标记!

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

这应该解决这个问题!


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?

解决方案

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!

这篇关于在WordPress模板中实现uploadify?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 02:47