Rumah >pembangunan bahagian belakang >tutorial php > uploadify上传文件报http500异常
uploadify上传文件报http500错误
我上传文件成功了,但是报http 500错误
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <link href="/public/js/uploadify/uploadify.css" rel="stylesheet" type="text/css"> <script src="/public/js/uploadify/jquery-1.4.2.min.js" type="text/javascript"></script> <script src="/public/js/uploadify/swfobject.js" type="text/javascript"></script> <script src="/public/js/uploadify/jquery.uploadify.v2.1.4.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $('#Filedata').uploadify({ 'uploader' : '/public/js/uploadify/uploadify.swf', 'script' : 'http://www.***.com/index.php/blog/article_post', 'cancelImg' : '/public/js/uploadify/cancel.png', 'queueID' : 'fileQueue',//与下面的上传文件列表id对应 'fileDesc' : '图片文件',//上传文件类型说明 'fileExt' :'*.txt;*.doc;*.pdf', //扩展名,启用本项时需同时声明fileDesc 'method' : 'get',//如果向后台传输数据,必须是get // 'sizeLimit':1000000,//文件上传的大小限制,单位是字节 'auto' : true,//是否自动上传 'multi' : false,//是否允许同时上传多文件,可设定true或false。 'height' : 31, 'width' : 90, 'simUploadLimit' : 1,// 同时上传文件的数量,设置了这个参数后,那么你会因设置multi:true和queueSizeLimit:8而可以多选8个文件,但如果一旦你将 simUploadLimit也设置了,那么只会上传这个参数指定的文件个数,其它就上传不了 //'buttonText' : 'shangchuan',//浏览按钮图片 'removeCompleted': false, 'folder' : '/static/', 'buttonImg': '/public/js/uploadify/imgfile.jpg', 'onError' : function(event, queueID, fileObj,errorObj){ alert("文件:" + fileObj.name + " 上传失败:" +errorObj.type + "Error:" + errorObj.info); } }); }); </script> <div id="fileQueue"></div> <input id="Filedata" name="Filedata" type="file">
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = $_SERVER['DOCUMENT_ROOT'].$_REQUEST['folder'] . '/'; $ext = pathinfo($_FILES['Filedata']['name']); $ext = $ext['extension']; if ($ext=='doc'||$ext=='pdf'||$ext=='txt') { $name = md5(uniqid(rand().microtime())).'.'.$ext; $targetFile = str_replace('//','/',$targetPath) . $name; } move_uploaded_file($tempFile,iconv('utf-8','gbk', $targetFile));//这里已经执行了 $path = str_replace($_SERVER['DOCUMENT_ROOT'],'',$targetFile); $param = array( 'name' => $name, 'path' => $path ); $data = Http::connect(CURL_HOST, CURL_PORT)->doPost(EN_SITEURL.'open.php/blog/logatt',$param, 'json');