swfupload 上传失败求解 本帖最后由 fiax23 于 2012-05-24 18:04:03 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 swfuploadvideo.php如下<?phprequire_once( dirname(__FILE__)."/config.php" );require_once( DEDEINC."/image.func.php" );if ( empty( $dopost ) ){ ini_set( "html_errors", "0" ); if ( empty( $Filedata ) || !is_uploaded_file( $Filedata ) ) { echo "ERROR: Upload Error! "; exit( 0 ); } $tmpdir =DEDEDATA."/uploadtmp"; if ( !is_dir( $tmpdir ) ) { MkdirAll( $tmpdir, $cfg_dir_purview ); CloseFtp( ); if ( !is_dir( $tmpdir ) ) { echo "ERROR: Create {$tmpdir} dir Error! "; exit( 0 ); } } $FiledataNew = str_replace( "\\", "/", $Filedata ); $FiledataNew = $tmpdir."/".preg_replace( "/(.*)[\\/]/isU", "", $FiledataNew ); move_uploaded_file( $Filedata, $FiledataNew ); $info = $ftype = $sname = ""; $ftype = "image/bmp"; $sname = ".flv"; $filedir = $cfg_image_dir."/".MyDate( $cfg_addon_savetype, time( ) ); if ( !is_dir( DEDEROOT.$filedir ) ) { MkdirAll( $cfg_basedir.$filedir, $cfg_dir_purview ); CloseFtp( ); } $filename = $cuserLogin->getUserID( )."-".dd2char( MyDate( "ymdHis", time( ) ) ); if ( file_exists( $cfg_basedir.$filedir."/".$filename.$sname ) ) { $i = 50; for ( ; $i <= 5000; $i++ ) { if ( !file_exists( $cfg_basedir.$filedir."/".$filename."-".$i.$sname ) ) { $filename = $filename."-".$i; break; } } } $fileurl = $filedir."/".$filename.$sname; $rs = copy( $FiledataNew, $cfg_basedir.$fileurl ); unlink( $FiledataNew ); if ( !$rs ) { echo "ERROR: Copy Uploadfile Error! "; exit( 0 ); } $title = $filename.$sname; $inquery = "INSERT INTO `#@__uploads`(title,url,mediatype,width,height,playtime,filesize,uptime,mid)\r\n VALUES ('{$title}','{$fileurl}','{$ftype}','0','0','0','".filesize( $cfg_basedir.$fileurl )."','".time( )."','".$cuserLogin->getUserID( )."'); "; $dsql->ExecuteNoneQuery( $inquery ); $fid = $dsql->GetLastID( ); AddMyAddon( $fid, $fileurl ); ob_start( ); ImageResizeNew( $cfg_basedir.$fileurl, $cfg_ddimg_width, $cfg_ddimg_height, "", FALSE ); $imagevariable = ob_get_contents( ); ob_end_clean( ); if ( !isset( $_SESSION['file_info'] ) ) { $_SESSION['file_info'] = array( ); } if ( !isset( $_SESSION['bigfile_info'] ) ) { $_SESSION['bigfile_info'] = array( ); } if ( !isset( $_SESSION['fileid'] ) ) { $_SESSION['fileid'] = 1; } else { $_SESSION['fileid']++; } $_SESSION['bigfile_info'][$_SESSION['fileid']] = $fileurl; $_SESSION['file_info'][$_SESSION['fileid']] = $imagevariable; echo "FILEID:".$_SESSION['fileid']; exit( 0 );}else if ( $dopost == "thumbnail" ){ if ( empty( $id ) ) { header( "HTTP/1.1 500 Internal Server Error" ); echo "No ID"; exit( 0 ); } echo $_SESSION['bigfile_info'][$id]; exit( 0 );}else if ( $dopost == "del" ){ if ( !isset( $_SESSION['bigfile_info'][$id] ) ) { echo ""; exit( ); } $dsql->ExecuteNoneQuery( "Delete From `#@__uploads` where url like '{$_SESSION['bigfile_info'][$id]}'; " ); @unlink( $cfg_basedir.$_SESSION['bigfile_info'][$id] ); $_SESSION['file_info'][$id] = ""; $_SESSION['bigfile_info'][$id] = ""; $_SESSION['huxingfile_info'][$id] = ""; echo "<b>已删除!</b>"; exit( );}else if ( $dopost == "ddimg" ){ ob_start( ); ImageResizeNew( $cfg_basedir.$img, $cfg_ddimg_width, $cfg_ddimg_height, "", FALSE ); $imagevariable = ob_get_contents( ); ob_end_clean( ); header( "Content-type: image/jpeg" ); header( "Content-Length: ".strlen( $imagevariable ) ); echo $imagevariable; exit( );}else if ( $dopost == "delold" ){ $imgfile = $cfg_basedir.$picfile; if ( !file_exists( $imgfile ) && !is_dir( $imgfile ) && ereg( "^".$cfg_medias_dir, $imgfile ) ) { @unlink( $imgfile ); } $dsql->ExecuteNoneQuery( "Delete From `#@__uploads` where url like '{$picfile}'; " ); echo "<b>已删除!</b>"; exit( );}?> 另附---SWFUpload Instance Info---Version: 2.2.0 2009-03-25Movie Name: SWFUpload_0Settings: upload_url: /swfuploadvideo.php flash_url: ../images/swfupload/swfupload.swf?preventswfcaching=1337855032033 use_query_string: false requeue_on_error: false http_success: assume_success_timeout: 0 file_post_name: Filedata post_params: [object Object] file_types: *.flv file_types_description: 选择 flv 格式视频 file_size_limit: 500 MB file_upload_limit: 1 file_queue_limit: 0 debug: true prevent_swf_caching: true button_placeholder_id: spanButtonPlaceholder button_placeholder: Not Set button_image_url: /img/SmallSpyGlassWithTransperancy_17x18.png button_width: 250 button_height: 18 button_text: <span class="button">选择本地视频 <span class="buttonSmall">(视频最大为 500 MB,支持多选)</span></span> button_text_style: .button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; } .buttonSmall { font-size: 10pt; } button_text_top_padding: 0 button_text_left_padding: 18 button_action: -110 button_disabled: false custom_settings: [object Object]Event Handlers: swfupload_loaded_handler assigned: false file_dialog_start_handler assigned: false file_queued_handler assigned: false file_queue_error_handler assigned: true upload_start_handler assigned: false upload_progress_handler assigned: true upload_error_handler assigned: true upload_success_handler assigned: true upload_complete_handler assigned: true debug_handler assigned: trueSWF DEBUG: SWFUpload Init CompleteSWF DEBUG: SWF DEBUG: ----- SWF DEBUG OUTPUT ----SWF DEBUG: Build Number: SWFUPLOAD 2.2.0SWF DEBUG: movieName: SWFUpload_0SWF DEBUG: Upload URL: /swfuploadvideo.phpSWF DEBUG: File Types String: *.flvSWF DEBUG: Parsed File Types: flvSWF DEBUG: HTTP Success: 0SWF DEBUG: File Types Description: 选择 flv 格式视频 (*.flv)SWF DEBUG: File Size Limit: 524288000 bytesSWF DEBUG: File Upload Limit: 1SWF DEBUG: File Queue Limit: 1SWF DEBUG: Post Params:SWF DEBUG: PHPSESSID=e03ac688ae0e6c40c72d798499511edcSWF DEBUG: dopost=SWF DEBUG: utype=shangjiaSWF DEBUG: ----- END SWF DEBUG OUTPUT ----SWF DEBUG: Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)SWF DEBUG: Event: fileDialogStart : Browsing files. Multi Select. Allowed file types: *.flvSWF DEBUG: Select Handler: Received the files selected from the dialog. Processing the file list...SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_0SWF DEBUG: Event: fileDialogComplete : Finished processing selected files. Files selected: 1. Files Queued: 1SWF DEBUG: StartUpload: First file in queueSWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0SWF DEBUG: Global Post Item: PHPSESSID=e03ac688ae0e6c40c72d798499511edcSWF DEBUG: Global Post Item: dopost=SWF DEBUG: Global Post Item: utype=shangjiaSWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for upload. Starting upload to /swfuploadvideo.php for File ID: SWFUpload_0_0SWF DEBUG: Event: uploadProgress (OPEN): File ID: SWFUpload_0_0SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 196608. Total: 2257395SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 2257395. Total: 2257395SWF DEBUG: Event: uploadSuccess: File ID: SWFUpload_0_0 Response Received: true Data: ERROR: Upload Error! SWF DEBUG: Event: uploadComplete : Upload cycle complete.EXCEPTION: message: 'document.getElementById(...)' 为空或不是对象EXCEPTION: number: -2146823281EXCEPTION: description: 'document.getElementById(...)' 为空或不是对象 既然,提示“$Filedata”获取不到,在往上面的代码找原因,是啥时候给$Filedata赋值,慢慢向上分析,看看 upload1 = new SWFUpload({ ..... file_post_name : "Filedata", .......});是不是这个属性的事,文件数据的发送名称。这个如果不一致,的确是获得不到文件数据和信息的。php部分 需要通过$_FILES["Filedata"]来获取数据问题应该出在这部分了 纠结 php.ini 配置问题 限制了上传文件大小 彩票复式拆分算法 小问题 请教 如何CRUL实现自动登录,(不是采集) php读取数据库中表问题 帮帮忙,初学,第一个函数就出错 请教:我在做一个OA中的一个考勤系统。在数据库的设计上和整个考勤思路是什么样的? php中的翻页是怎么实现的,望指点,在线等…… 一个字体的问题 请问PHP里XPath查找出数据后如何让它不返回数据结构只返回值? 直接输入链接不显示内容如何php来实现呢?请大神给分享一下 php 正则问题
require_once( dirname(__FILE__)."/config.php" );
require_once( DEDEINC."/image.func.php" );
if ( empty( $dopost ) )
{ ini_set( "html_errors", "0" );
if ( empty( $Filedata ) || !is_uploaded_file( $Filedata ) )
{
echo "ERROR: Upload Error! ";
exit( 0 );
}
$tmpdir =DEDEDATA."/uploadtmp";
if ( !is_dir( $tmpdir ) )
{
MkdirAll( $tmpdir, $cfg_dir_purview );
CloseFtp( );
if ( !is_dir( $tmpdir ) )
{
echo "ERROR: Create {$tmpdir} dir Error! ";
exit( 0 );
}
}
$FiledataNew = str_replace( "\\", "/", $Filedata );
$FiledataNew = $tmpdir."/".preg_replace( "/(.*)[\\/]/isU", "", $FiledataNew );
move_uploaded_file( $Filedata, $FiledataNew );
$info = $ftype = $sname = "";
$ftype = "image/bmp";
$sname = ".flv";
$filedir = $cfg_image_dir."/".MyDate( $cfg_addon_savetype, time( ) );
if ( !is_dir( DEDEROOT.$filedir ) )
{
MkdirAll( $cfg_basedir.$filedir, $cfg_dir_purview );
CloseFtp( );
}
$filename = $cuserLogin->getUserID( )."-".dd2char( MyDate( "ymdHis", time( ) ) );
if ( file_exists( $cfg_basedir.$filedir."/".$filename.$sname ) )
{
$i = 50;
for ( ; $i <= 5000; $i++ )
{
if ( !file_exists( $cfg_basedir.$filedir."/".$filename."-".$i.$sname ) )
{
$filename = $filename."-".$i;
break;
}
}
}
$fileurl = $filedir."/".$filename.$sname;
$rs = copy( $FiledataNew, $cfg_basedir.$fileurl );
unlink( $FiledataNew );
if ( !$rs )
{
echo "ERROR: Copy Uploadfile Error! ";
exit( 0 );
}
$title = $filename.$sname;
$inquery = "INSERT INTO `#@__uploads`(title,url,mediatype,width,height,playtime,filesize,uptime,mid)\r\n VALUES ('{$title}','{$fileurl}','{$ftype}','0','0','0','".filesize( $cfg_basedir.$fileurl )."','".time( )."','".$cuserLogin->getUserID( )."'); ";
$dsql->ExecuteNoneQuery( $inquery );
$fid = $dsql->GetLastID( );
AddMyAddon( $fid, $fileurl );
ob_start( );
ImageResizeNew( $cfg_basedir.$fileurl, $cfg_ddimg_width, $cfg_ddimg_height, "", FALSE );
$imagevariable = ob_get_contents( );
ob_end_clean( );
if ( !isset( $_SESSION['file_info'] ) )
{
$_SESSION['file_info'] = array( );
}
if ( !isset( $_SESSION['bigfile_info'] ) )
{
$_SESSION['bigfile_info'] = array( );
}
if ( !isset( $_SESSION['fileid'] ) )
{
$_SESSION['fileid'] = 1;
}
else
{
$_SESSION['fileid']++;
}
$_SESSION['bigfile_info'][$_SESSION['fileid']] = $fileurl;
$_SESSION['file_info'][$_SESSION['fileid']] = $imagevariable;
echo "FILEID:".$_SESSION['fileid'];
exit( 0 );
}
else if ( $dopost == "thumbnail" )
{
if ( empty( $id ) )
{
header( "HTTP/1.1 500 Internal Server Error" );
echo "No ID";
exit( 0 );
}
echo $_SESSION['bigfile_info'][$id];
exit( 0 );
}
else if ( $dopost == "del" )
{
if ( !isset( $_SESSION['bigfile_info'][$id] ) )
{
echo "";
exit( );
}
$dsql->ExecuteNoneQuery( "Delete From `#@__uploads` where url like '{$_SESSION['bigfile_info'][$id]}'; " );
@unlink( $cfg_basedir.$_SESSION['bigfile_info'][$id] );
$_SESSION['file_info'][$id] = "";
$_SESSION['bigfile_info'][$id] = "";
$_SESSION['huxingfile_info'][$id] = "";
echo "<b>已删除!</b>";
exit( );
}
else if ( $dopost == "ddimg" )
{
ob_start( );
ImageResizeNew( $cfg_basedir.$img, $cfg_ddimg_width, $cfg_ddimg_height, "", FALSE );
$imagevariable = ob_get_contents( );
ob_end_clean( );
header( "Content-type: image/jpeg" );
header( "Content-Length: ".strlen( $imagevariable ) );
echo $imagevariable;
exit( );
}
else if ( $dopost == "delold" )
{
$imgfile = $cfg_basedir.$picfile;
if ( !file_exists( $imgfile ) && !is_dir( $imgfile ) && ereg( "^".$cfg_medias_dir, $imgfile ) )
{
@unlink( $imgfile );
}
$dsql->ExecuteNoneQuery( "Delete From `#@__uploads` where url like '{$picfile}'; " );
echo "<b>已删除!</b>";
exit( );
}
?>
Version: 2.2.0 2009-03-25
Movie Name: SWFUpload_0
Settings:
upload_url: /swfuploadvideo.php
flash_url: ../images/swfupload/swfupload.swf?preventswfcaching=1337855032033
use_query_string: false
requeue_on_error: false
http_success:
assume_success_timeout: 0
file_post_name: Filedata
post_params: [object Object]
file_types: *.flv
file_types_description: 选择 flv 格式视频
file_size_limit: 500 MB
file_upload_limit: 1
file_queue_limit: 0
debug: true
prevent_swf_caching: true
button_placeholder_id: spanButtonPlaceholder
button_placeholder: Not Set
button_image_url: /img/SmallSpyGlassWithTransperancy_17x18.png
button_width: 250
button_height: 18
button_text: <span class="button">选择本地视频 <span class="buttonSmall">(视频最大为 500 MB,支持多选)</span></span>
button_text_style: .button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; } .buttonSmall { font-size: 10pt; }
button_text_top_padding: 0
button_text_left_padding: 18
button_action: -110
button_disabled: false
custom_settings: [object Object]
Event Handlers:
swfupload_loaded_handler assigned: false
file_dialog_start_handler assigned: false
file_queued_handler assigned: false
file_queue_error_handler assigned: true
upload_start_handler assigned: false
upload_progress_handler assigned: true
upload_error_handler assigned: true
upload_success_handler assigned: true
upload_complete_handler assigned: true
debug_handler assigned: trueSWF DEBUG: SWFUpload Init Complete
SWF DEBUG:
SWF DEBUG: ----- SWF DEBUG OUTPUT ----
SWF DEBUG: Build Number: SWFUPLOAD 2.2.0
SWF DEBUG: movieName: SWFUpload_0
SWF DEBUG: Upload URL: /swfuploadvideo.php
SWF DEBUG: File Types String: *.flv
SWF DEBUG: Parsed File Types: flv
SWF DEBUG: HTTP Success: 0
SWF DEBUG: File Types Description: 选择 flv 格式视频 (*.flv)
SWF DEBUG: File Size Limit: 524288000 bytes
SWF DEBUG: File Upload Limit: 1
SWF DEBUG: File Queue Limit: 1
SWF DEBUG: Post Params:
SWF DEBUG: PHPSESSID=e03ac688ae0e6c40c72d798499511edc
SWF DEBUG: dopost=
SWF DEBUG: utype=shangjia
SWF DEBUG: ----- END SWF DEBUG OUTPUT ----
SWF DEBUG:
Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)
SWF DEBUG: Event: fileDialogStart : Browsing files. Multi Select. Allowed file types: *.flv
SWF DEBUG: Select Handler: Received the files selected from the dialog. Processing the file list...
SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_0
SWF DEBUG: Event: fileDialogComplete : Finished processing selected files. Files selected: 1. Files Queued: 1
SWF DEBUG: StartUpload: First file in queue
SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0
SWF DEBUG: Global Post Item: PHPSESSID=e03ac688ae0e6c40c72d798499511edc
SWF DEBUG: Global Post Item: dopost=
SWF DEBUG: Global Post Item: utype=shangjia
SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for upload. Starting upload to /swfuploadvideo.php for File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadProgress (OPEN): File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 196608. Total: 2257395
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 2257395. Total: 2257395
SWF DEBUG: Event: uploadSuccess: File ID: SWFUpload_0_0 Response Received: true Data: ERROR: Upload Error!
SWF DEBUG: Event: uploadComplete : Upload cycle complete.
EXCEPTION: message: 'document.getElementById(...)' 为空或不是对象
EXCEPTION: number: -2146823281
EXCEPTION: description: 'document.getElementById(...)' 为空或不是对象
这个如果不一致,的确是获得不到文件数据和信息的。php部分 需要通过$_FILES["Filedata"]来获取数据
问题应该出在这部分了