onunix
- onunix 发布了话题为什么我写的文件找不到模型文件呢?
- onunix 发布了话题CGridView表格支持图片链接?
- onunix 回复了话题 使用swfupload上传出404错误
多谢答复。现在已经没有这个错误了。这是我刚刚开始swfupload时犯的低级错误。
请问上传过程应该跟踪哪个函数呢?看来文件没有生成,可能问题出在上传过程中。
似乎文件没有传上去,没有传上去,
move_uploaded_file
当然没有用。去掉了move_uploaded_file,代码如下:
try{ $filedata=$_FILES['Filedata']; echo $filedata['tmp_name']; } catch(Exception $e){ echo 'Error: ' . $e->getMessage(); }
调试信息如下:
SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for upload. Starting upload to /Yii/index.php?r=vEHICLEPICTURE/upload&PHPSESSID=s60td0gov8cumesuegrkrenk13 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: 95490. Total: 95490 SWF DEBUG: Event: uploadSuccess: File ID: SWFUpload_0_0 Response Received: true Data: [color=Blue]C:\Documents and Settings\Administrator\Local Settings\Temp\1\php88.tmp[/color] SWF DEBUG: Event: uploadComplete : Upload cycle complete. EXCEPTION: message: 'document.getElementById(...)' 为空或不是对象 EXCEPTION: number: -2146823281 EXCEPTION: description: 'document.getElementById(...)' 为空或不是对象
但是去找,没有找到 这个文件:
C:\Documents and Settings\Administrator\Local Settings\Temp\1\php88.tmp
似乎文件根本没有生成,怎么回事呢?
- onunix 回复了话题 使用swfupload上传出404错误
我查看了下网页的源代码:
swfu = new SWFUpload({'post_params':{'PHPSESSID':'fm9ua3qbobe1476p63fj9fk3l2'},'flash_url':'/Yii/assets/ee5da5a6/swfupload.swf','use_query_string':true,'upload_url':'/Yii/index.php?r=upload'
我的Yii目录下有个upload的子目录,
请问这样是有问题的吗?
- onunix 回复了话题 使用swfupload上传出404错误
请问哪一个地方是配路径的啊?
<?php $this->widget('application.extensions.swfupload.CSwfUpload', array( 'jsHandlerUrl'=>'\Yii\path\to\handler.js', //Relative path 'postParams'=>array(), 'config'=>array( 'use_query_string'=>true, 'upload_url'=>Yii::app()->createUrl('upload'), 'file_size_limit'=>'2 MB', 'file_types'=>'*.jpg;*.png;*.gif', 'file_types_description'=>'Image Files', 'file_upload_limit'=>0, 'file_queue_error_handler'=>'js:fileQueueError', 'file_dialog_complete_handler'=>'js:fileDialogComplete', 'upload_progress_handler'=>'js:uploadProgress', 'upload_error_handler'=>'js:uploadError', 'upload_success_handler'=>'js:uploadSuccess', 'upload_complete_handler'=>'js:uploadComplete', 'custom_settings'=>array('upload_target'=>'divFileProgressContainer'), 'button_placeholder_id'=>'swfupload', 'button_width'=>170, 'button_height'=>20, 'button_text'=>'<span class="button">'.Yii::t('messageFile', 'ButtonLabel').' (Max 2 MB)</span>', 'button_text_style'=>'.button { font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif; font-size: 11pt; text-align: center; }', 'button_text_top_padding'=>0, 'button_text_left_padding'=>0, 'button_window_mode'=>'js:SWFUpload.WINDOW_MODE.TRANSPARENT', 'button_cursor'=>'js:SWFUpload.CURSOR.HAND', ), ) ); ?> <?php echo CHtml::beginForm(); ?> <div class="form"> <div class="row"> <div id="divFileProgressContainer"></div> <div class="swfupload"><span id="swfupload">abc</span></div> </div> </div> <?php echo CHtml::endForm(); ?>
是否这行有问题,
'upload_url'=>Yii::app()->createUrl('upload')
, 不是太明白这是用于做什么,是用于确定下载到服务器上的路径吗?