gpt4 book ai didi

javascript - 如何使用 Uploadify 发送参数?

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:06:51 33 4
gpt4 key购买 nike

我正在尝试用 Uploadify 替换 Wordpress 中的 SWFUpload,因为它似乎更易于自定义且更易于使用。

现在,我了解到 Wordpress 在上传文件时会发送一些数据用于服务器验证。我很好奇如何在我的 Uploadify 表单中使用这些数据来替换 Wordpress 自己的上传表单。

这是来自 Wordpress 的上传表单示例:

<object width="132" height="23" class="swfupload" data="http://xxx.com/wp-includes/js/swfupload/swfupload.swf?preventswfcaching=1300750794560" type="application/x-shockwave-flash" id="SWFUpload_0">
<param value="window" name="wmode">
<param value="http://xxx.com/wp-includes/js/swfupload/swfupload.swf?preventswfcaching=1300750794560" name="movie">
<param value="high" name="quality">
<param value="false" name="menu">
<param value="always" name="allowScriptAccess">
<param value="movieName=SWFUpload_0&amp;uploadURL=http%3A%2F%2Fxxx.com%2Fwp-admin%2Fasync-upload.php&amp;useQueryString=false&amp;requeueOnError=false&amp;httpSuccess=&amp;assumeSuccessTimeout=0&amp;params=post_id%3D3562%26amp%3Bauth_cookie%3Dadmin%257C1301439526%257C5e5e63158e880597c782656a719f1738%26amp%3Blogged_in_cookie%3Dadmin%257C1301439526%257Ce01206ec12b5cee4a605f9abff385cc0%26amp%3B_wpnonce%3Dc52b08b0ce%26amp%3Btype%3Dimage%26amp%3Btab%3Dtype%26amp%3Bshort%3D1&amp;filePostName=async-upload&amp;fileTypes=*.*&amp;fileTypesDescription=All%20Files&amp;fileSizeLimit=4194304b&amp;fileUploadLimit=0&amp;fileQueueLimit=0&amp;debugEnabled=false&amp;buttonImageURL=http%3A%2F%2Fxxx.com%2Fwp-includes%2Fimages%2Fupload.png%3Fver%3D20100531&amp;buttonWidth=132&amp;buttonHeight=23&amp;buttonText=%3Cspan%20class%3D%22button%22%3ESelect%20Files%3C%2Fspan%3E&amp;buttonTextTopPadding=3&amp;buttonTextLeftPadding=0&amp;buttonTextStyle=.button%20%7B%20text-align%3A%20center%3B%20font-weight%3A%20bold%3B%20font-family%3A%22Lucida%20Grande%22%2CVerdana%2CArial%2C%22Bitstream%20Vera%20Sans%22%2Csans-serif%3B%20font-size%3A%2011px%3B%20text-shadow%3A%200%201px%200%20%23FFFFFF%3B%20color%3A%23464646%3B%20%7D&amp;buttonAction=-110&amp;buttonDisabled=false&amp;buttonCursor=-1" name="flashvars">
</object>

现在,我猜这个表单数据是在这里生成的: http://pastie.org/private/dxuytcqhu7b9odfhkwug(此处的完整代码:http://phpxref.ftwr.co.uk/wordpress/nav.html?wp-admin/includes/media.php.source.html 从第 1494 行开始)

但除此之外,我还一无所知。如何通过 Uploadify 发送所需的参数?脚本数据?需要哪些参数?这可能吗?

最佳答案

使用 scriptData 配置中的选项。在下面的示例中,有两个参数被发送 m nameage

$('#file_upload').uploadify({
'uploader' : '/uploadify/uploadify.swf',
'script' : '/uploadify/uploadify.php',
'cancelImg' : '/uploadify/cancel.png',
'folder' : '/uploads',
'scriptData' : {'name':'Ronnie','age':30}
});

关于javascript - 如何使用 Uploadify 发送参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5385181/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com