Загрузить загрузку файлов

Я пытаюсь использовать uploadify, загружать файлы pdf или txt, но безуспешно. Uploadify 2.1.4 загружает только файлы изображений. Я попытался просто переименовать расширения файлов, попробовал разрешить . , попытался именно разрешить PDF или другие форматы, но Uploadify загружает только F ****** g изображений, и я не знаю, почему …

Пожалуйста, помогите мне.

Я использую следующие настройки:

public function show() { if(!$this->dir) throw new exception("Upload dir is not set"); if(!$this->url) throw new exception("Upload url is not set"); $rem=(isset($_POST[$this->name."-rem"]))?$_POST[$this->name."-rem"]:""; $tpl='<div id="'.$this->name.'-queue" class="upload-queue">'.$this->fillQueue().'</div>'; $tpl.='<input id="'.$this->name.'-uploadify" name="'.$this->name.'-uploadify" type="file" />'; $tpl.='<input id="'.$this->name.'-files" name="'.$this->name.'-files" type="hidden" />'; $tpl.='<input id="'.$this->name.'-rem" name="'.$this->name.'-rem" type="hidden" value="'.$rem.'"/>'; //$tpl.='<link rel="stylesheet" type="text/css" href="/uploadify/uploadify.css" />'; $tpl.="<script type=\"text/javascript\"><!-- var ".$this->name."Files=".$this->currentCount."; function ".$this->name."DeleteFile(where) { var rem=$('#".$this->name."-rem').val(); if(rem!='') rem+=','; $('#".$this->name."-rem').val(rem+$(where).parent().attr('id')); $(where).parent().remove(); ".$this->name."Files--; if(".$this->name."Files<".$this->count.") $(\"#".$this->name."-uploadifyUploader\").show(); } $(document).ready(function() { $(\"#".$this->name."-uploadify\").uploadify({ 'uploader' : '/uploadify/uploadify.swf', 'script' : '".$this->url."', 'scriptData' : {'".session_name()."':'".session_id()."'}, 'cancelImg' : '/uploadify/cancel.png', 'folder' : '".$this->dir."/thumb', 'queueID' : '".$this->name."-queue', 'auto' : true, 'multi' : ".(($this->count>1)?"true":"false").", 'buttonText' : '".$this->buttonName."', 'fileExt' : '".rtrim($this->fileExt,";")."', 'fileDesc' : '".rtrim($this->fileDesc,",")."', onError : function (a, b, c, d) { if (d.status == 404) alert('Could not find upload script. Use a path relative to: '+'<?= getcwd() ?>'); else if (d.type === \"HTTP\") alert('error '+d.type+\": \"+d.status); else if (d.type ===\"File Size\") alert(c.name+' '+d.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB'); else alert('error '+d.type+\": \"+d.text); }, onComplete : function(event, queueID, fileObj, response, data){ $(\"#".$this->name."-queue\").append('<div id=\"'+fileObj.filePath+'\" class=\"item\"><div style=\"background: url('+fileObj.filePath+') no-repeat 50% 50%\"></div><img src=\"/uploadify/cancel.png\" class=\"delete-file\" onclick=\"".$this->name."DeleteFile(this);\"></div>'); $('#".$this->name."-queue').sortable('refresh'); ".$this->name."Files++; if(".$this->name."Files>=".$this->count.") $(\"#".$this->name."-uploadifyUploader\").hide(); }, onInit : function(){setTimeout(function(){if(".$this->name."Files>=".$this->count.") $(\"#".$this->name."-uploadifyUploader\").hide();},500);} }); $('#".$this->name."-queue').sortable(); $('#".$this->name."-queue').disableSelection(); $('form').submit(function(){ $('#".$this->name."-files').val($('#".$this->name."-queue').sortable('toArray')); }); }); --></script>"; return array("",$tpl); } 

Спасибо!

 var settingObject = { 'uploader' : '/uploadify/uploadify.swf', // set your path 'checkScript':'/uploadify/check.php', // set your path 'script' : '/uploadify/uploadify.php', // set your path 'cancelImg' : '/uploadify/cancel.png', // set your path 'folder' : '/files/useruploads', 'auto' : true, 'fileExt' : '*.jpg;*.gif;*.png;*.txt;*.pdf;*.doc;*.docx', // any extension you want to allow 'fileDesc' : 'Upload Files (.JPG, .GIF, .PNG, .TXT, .PDF, .DOC, .DOCX)', 'removeCompleted': false }; $("#file-1").uploadify(settingObject); 

Ссылка: (расширение файла) http://www.uploadify.com/documentation/options/fileext/

Это должно сработать для вас.

Возможно, существует проблема ограничения размера для каждого файла. Попробуйте добавить следующие

 'sizeLimit': 500000 

Попробуйте изменить upload_max_filesize в php.ini

Измените свои текущие параметры:

 $('#file_upload').uploadify({ 'uploader' : '/uploadify/uploadify.swf', 'script' : '/uploadify/uploadify.php', 'cancelImg' : '/uploadify/cancel.png', 'folder' : '/uploads', 'fileTypeExt' : '*.jpg;*.gif;*.png', <== this line 'fileTypeDesc' : 'Image Files' }); 

Для справки: http://www.uploadify.com/documentation/uploadify/filetypeexts/

Измените эти строки:

 'fileTypeExt' : '*.txt;*.pdf;', 'fileTypeDesc' : '*.txt and *.pdf', 

Используйте 'fileExt' : '*.pdf;*.jpg;*.jpeg;*.png', вместо имени файла, который его читает.