加载服务器上的图像时出错

时间:2018-01-01 14:38:29

标签: php mysql

早上好,我说英语不好,我来自巴西,我正在使用谷歌翻译。

我很抱歉我的英语错误。

我的横幅广告制作网站出现问题

当我上传图片时,服务器上没有加载

进入站点控制台时,我得到这些错误,请看图像 enter image description here

HTML文件的代码没有放在这里扑克非常大

Banner Maker Link enter link description here

非常感谢您的帮助。

这是代码upload_photo.php

<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/criador-de-banner/config/settings.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/criador-de-banner/php/functions.php');

$main_folder=$_SERVER['DOCUMENT_ROOT'].'/photos/';
$year_folder=date("Y").'/';
$month_folder=date("M").'/';
$full_path=$main_folder.$year_folder.$month_folder;

if (!file_exists('../photos/'.$year_folder))
	{
		makeDir($year_folder);
	}
if (!file_exists('../photos/'.$year_folder.$month_folder))
	{
		makeDir($year_folder.$month_folder);
	}

	$s_ext=strtolower(pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION));
	$uniqid=uniqid();
	$destination = $uniqid.'.'.$s_ext;

$temp_image=$_FILES["file"]["tmp_name"];
if (getMimeType($temp_image))
	{
	move_uploaded_file($_FILES["file"]["name"], $full_path.$destination);
	echo '/photos/'.$year_folder.$month_folder.$destination;
	}else{
	echo 'error';	
	}
?>

这是代码functions.php

<?php
//-------------------FTP functions-------------------------

    function makeDir($the_dir)
	{
	$dir = ROOT_FOLDER.'photos/'.$the_dir;
	$conn_id = ftp_connect('localhost');
	$login_result = ftp_login($conn_id, DB_USER, FTP_PASS);
	if (ftp_mkdir($conn_id, $dir)) {
		ftp_chmod($conn_id, 0777, $dir) !== false;
		}
	ftp_close($conn_id);
	} 

//-------------------Image functions-------------------------

function getMimeType($filename)
{
    $mimetype = false;
    if (function_exists('getimagesize')) {
       $mimetype = getimagesize($filename);
    } elseif(function_exists('exif_imagetype')) {
       $mimetype = exif_imagetype($filename);
    } elseif(function_exists('mime_content_type')) {
       $mimetype = mime_content_type($filename);
    }
    return $mimetype;
}
?>

这是代码upload_image.js

var _$_f464=["holder","getElementById","undefined","draggable","span","createElement","FormData","upload","filereader","formdata","progress","uploadprogress","className","fail","hidden","forEach"," ","split","filereader formdata progress","type","onload","","html","div","children","#holder","src","result","target","firstChild","insertBefore","readAsDataURL","Only image files are acceptable.","file","append","POST","php/upload_photo.php","open","value","innerHTML","responseText","error","log","Por favor, Espere...","filter","alpha(opacity=0)","css","opacity","0",".canvas_container","height","attr","width","hide","#image_canvas","max-height","95%","max-width","100%","drawImage","197px","#desaturate","desaturate","2d","getContext","#sepia","sepia","#grayscale","grayscale","#addnoise","addnoise","#expose","expose","#tint","tint","#vignette","vignette",".dragNdropImagePanel","show",".EditImagePanel","1","alpha(opacity=1)","animate",".aligner","find","fadeIn","scale","btn_disabled","addClass",".load_the_image","removeClass",".open_load_image_panel",".editImagePanel","onprogress","lengthComputable","loaded","total","send","dnd","ondragover","hover","ondragend","ondrop","preventDefault","files","dataTransfer","onchange","input","querySelector","click","trigger","#file_form","on","change","prop"];var holder=document[_$_f464[1]](_$_f464[0]),tests={filereader: typeof FileReader!=_$_f464[2],dnd:_$_f464[3] in document[_$_f464[5]](_$_f464[4]),formdata:!!window[_$_f464[6]],progress:_$_f464[7] in  new XMLHttpRequest},support={filereader:document[_$_f464[1]](_$_f464[8]),formdata:document[_$_f464[1]](_$_f464[9]),progress:document[_$_f464[1]](_$_f464[10])},acceptedTypes={"image/png":true,"image/jpeg":true,"image/gif":true},progress=document[_$_f464[1]](_$_f464[11]),fileupload=document[_$_f464[1]](_$_f464[7]);_$_f464[18][_$_f464[17]](_$_f464[16])[_$_f464[15]](function(api){if(tests[api]===false){support[api][_$_f464[12]]=_$_f464[13]}else {support[api][_$_f464[12]]=_$_f464[14]}});function previewfile(file){if(tests[_$_f464[8]]===true&&acceptedTypes[file[_$_f464[19]]]===true){var reader= new FileReader();reader[_$_f464[20]]=function(event){$(_$_f464[25])[_$_f464[24]](_$_f464[23])[_$_f464[22]](_$_f464[21]);var image= new Image();image[_$_f464[26]]=event[_$_f464[28]][_$_f464[27]];holder[_$_f464[30]](image,holder[_$_f464[29]]);};reader[_$_f464[31]](file);}else {alert(_$_f464[32])}}function readfiles(files){var formData=tests[_$_f464[9]]? new FormData():null;for(var i=0;i<1;i++){if(tests[_$_f464[9]]){formData[_$_f464[34]](_$_f464[33],files[i])};previewfile(files[i]);};if(tests[_$_f464[9]]){var xhr= new XMLHttpRequest();xhr[_$_f464[37]](_$_f464[35],DOMAIN_NAME+_$_f464[36]);xhr[_$_f464[20]]=function(){progress[_$_f464[38]]=progress[_$_f464[39]]=100;progress[_$_f464[38]]=progress[_$_f464[39]]=0;if(xhr[_$_f464[40]]!==_$_f464[41]){console[_$_f464[42]](xhr[_$_f464[40]]);uploaded_image_url=xhr[_$_f464[40]];$(_$_f464[25])[_$_f464[24]](_$_f464[23])[_$_f464[22]](_$_f464[43]);var temp_img= new Image;temp_img[_$_f464[20]]=function(){$(_$_f464[49])[_$_f464[46]](_$_f464[47],_$_f464[48])[_$_f464[46]](_$_f464[44],_$_f464[45]);$(_$_f464[54])[_$_f464[53]]()[_$_f464[51]](_$_f464[52],temp_img[_$_f464[52]])[_$_f464[51]](_$_f464[50],temp_img[_$_f464[50]]);$(_$_f464[54])[_$_f464[46]](_$_f464[57],_$_f464[58])[_$_f464[46]](_$_f464[55],_$_f464[56]);image_context[_$_f464[59]](temp_img,0,0);$(_$_f464[61])[_$_f464[51]](_$_f464[52],temp_img[_$_f464[52]])[_$_f464[51]](_$_f464[50],temp_img[_$_f464[50]])[_$_f464[46]](_$_f464[52],_$_f464[60]);var cv=document[_$_f464[1]](_$_f464[62]),ctx=cv[_$_f464[64]](_$_f464[63]);ctx[_$_f464[59]](temp_img,0,0);image_effect_saturate(ctx);image_effect_saturate(ctx);image_effect_saturate(ctx);$(_$_f464[65])[_$_f464[51]](_$_f464[52],temp_img[_$_f464[52]])[_$_f464[51]](_$_f464[50],temp_img[_$_f464[50]])[_$_f464[46]](_$_f464[52],_$_f464[60]);cv=document[_$_f464[1]](_$_f464[66]);ctx=cv[_$_f464[64]](_$_f464[63]);ctx[_$_f464[59]](temp_img,0,0);image_effect_sepia(ctx);image_effect_sepia(ctx);image_effect_sepia(ctx);$(_$_f464[67])[_$_f464[51]](_$_f464[52],temp_img[_$_f464[52]])[_$_f464[51]](_$_f464[50],temp_img[_$_f464[50]])[_$_f464[46]](_$_f464[52],_$_f464[60]);cv=document[_$_f464[1]](_$_f464[68]);ctx=cv[_$_f464[64]](_$_f464[63]);ctx[_$_f464[59]](temp_img,0,0);image_effect_grayscale(ctx);image_effect_grayscale(ctx);image_effect_grayscale(ctx);$(_$_f464[69])[_$_f464[51]](_$_f464[52],temp_img[_$_f464[52]])[_$_f464[51]](_$_f464[50],temp_img[_$_f464[50]])[_$_f464[46]](_$_f464[52],_$_f464[60]);cv=document[_$_f464[1]](_$_f464[70]);ctx=cv[_$_f464[64]](_$_f464[63]);ctx[_$_f464[59]](temp_img,0,0);image_effect_addnoise(ctx);image_effect_addnoise(ctx);image_effect_addnoise(ctx);$(_$_f464[71])[_$_f464[51]](_$_f464[52],temp_img[_$_f464[52]])[_$_f464[51]](_$_f464[50],temp_img[_$_f464[50]])[_$_f464[46]](_$_f464[52],_$_f464[60]);cv=document[_$_f464[1]](_$_f464[72]);ctx=cv[_$_f464[64]](_$_f464[63]);ctx[_$_f464[59]](temp_img,0,0);image_effect_bc(ctx);image_effect_bc(ctx);image_effect_bc(ctx);$(_$_f464[73])[_$_f464[51]](_$_f464[52],temp_img[_$_f464[52]])[_$_f464[51]](_$_f464[50],temp_img[_$_f464[50]])[_$_f464[46]](_$_f464[52],_$_f464[60]);cv=document[_$_f464[1]](_$_f464[74]);ctx=cv[_$_f464[64]](_$_f464[63]);ctx[_$_f464[59]](temp_img,0,0);image_effect_tint(ctx);image_effect_tint(ctx);image_effect_tint(ctx);$(_$_f464[75])[_$_f464[51]](_$_f464[52],temp_img[_$_f464[52]])[_$_f464[51]](_$_f464[50],temp_img[_$_f464[50]])[_$_f464[46]](_$_f464[52],_$_f464[60]);cv=document[_$_f464[1]](_$_f464[76]);ctx=cv[_$_f464[64]](_$_f464[63]);ctx[_$_f464[59]](temp_img,0,0);image_effect_vignette(ctx);setTimeout(function(){$(_$_f464[77])[_$_f464[53]]();$(_$_f464[79])[_$_f464[78]]();$(_$_f464[49])[_$_f464[50]](dev_height-216)[_$_f464[82]]({"opacity":_$_f464[80],"filter":_$_f464[81]},300);$(_$_f464[49])[_$_f464[84]](_$_f464[83])[_$_f464[50]](dev_height-216);$(_$_f464[54])[_$_f464[85]](300);crop_coordinates={x:0,y:0,width:temp_img[_$_f464[52]],height:temp_img[_$_f464[50]]};crop_coordinates[_$_f464[86]]=$(target)[_$_f464[52]]()/crop_coordinates[_$_f464[52]];console[_$_f464[42]]($(target)[_$_f464[52]]());$(_$_f464[89])[_$_f464[88]](_$_f464[87]);$(_$_f464[91])[_$_f464[90]](_$_f464[87]);$(_$_f464[92])[_$_f464[78]]();original_image=true;},400);};temp_img[_$_f464[26]]=uploaded_image_url;$(_$_f464[92])[_$_f464[78]]();}else {console[_$_f464[42]](_$_f464[32])};};if(tests[_$_f464[10]]){xhr[_$_f464[7]][_$_f464[93]]=function(event){if(event[_$_f464[94]]){var complete=(event[_$_f464[95]]/event[_$_f464[96]]*100|0);progress[_$_f464[38]]=progress[_$_f464[39]]=complete;console[_$_f464[42]](xhr[_$_f464[40]]);}}};xhr[_$_f464[97]](formData);};}if(tests[_$_f464[98]]){holder[_$_f464[99]]=function(){this[_$_f464[12]]=_$_f464[100];return false;};holder[_$_f464[101]]=function(){this[_$_f464[12]]=_$_f464[21];return false;};holder[_$_f464[102]]=function(e){this[_$_f464[12]]=_$_f464[21];e[_$_f464[103]]();var thisfiles=e[_$_f464[105]][_$_f464[104]];console[_$_f464[42]](thisfiles[0]);if(acceptedTypes[thisfiles[0][_$_f464[19]]]){readfiles(thisfiles)}else {alert(_$_f464[32])};};}else {fileupload[_$_f464[12]]=_$_f464[14];fileupload[_$_f464[108]](_$_f464[107])[_$_f464[106]]=function(){var thisfiles=this[_$_f464[104]];if(acceptedTypes[thisfiles[0][_$_f464[19]]]){readfiles(thisfiles)}else {alert(_$_f464[32])};};};$(_$_f464[89])[_$_f464[112]](_$_f464[109],function(){$(_$_f464[111])[_$_f464[110]](_$_f464[109])});$(_$_f464[111])[_$_f464[112]](_$_f464[113],function(){var thisfiles=$(_$_f464[111])[_$_f464[114]](_$_f464[104]);console[_$_f464[42]]($(_$_f464[111])[_$_f464[114]](_$_f464[104]));if(acceptedTypes[thisfiles[0][_$_f464[19]]]){readfiles(thisfiles)}else {alert(_$_f464[32])};});

1 个答案:

答案 0 :(得分:0)

更改此行:

move_uploaded_file($_FILES["file"]["name"], $full_path.$destination);

到此:

move_uploaded_file($_FILES["file"]["tmp_name"], $full_path.$destination);

根据php documentation