Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

leo23costa

Codigo funciona na maquina local porém no UOL HOST não funciona

Recommended Posts

Bom dia pessoal ... O código abaixo funciona perfeitamente no meu pc local ...

Porém no UOL HOST o mesmo código da problema. Já pedi ajuda no suporte e não resolveram ...

Será que o erro é no meu código como me informaram ?

 

Por favor me ajudem ...

 

 

abreChamado.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt-br" lang="pt-br" dir="ltr" >
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta name="generator" content="Joomla! - Open Source Content Management" />
  <title>Chamados T.I.</title>
  <link rel="stylesheet" href="template.css" type="text/css" />
  <script type="text/javascript" src="../modernizr-latest.js"></script>
  <script src="js/jquery-2.1.1.js"></script>  
  <script src="js/paste_image.js"></script>
  
<!--[if IE 7]>
<link href="templates/bluestork/css/ie7.css" rel="stylesheet" type="text/css" />
<![endif]-->

<!--[if gte IE 8]>
<link href="templates/bluestork/css/ie8.css" rel="stylesheet" type="text/css" />
<![endif]-->

<script language="Javascript">
function Contar(Campo){
document.getElementById("Qtd").innerText = 1000-Campo.value.length + " caracteres restantes.";
if((1000-Campo.value.length)==0)
alert('Atenção, você atingiu o limite máximo de caracteres!');
}
</script>
</head>
<body id="minwidth-body">
<?php
	session_start();
	if($_SESSION['status'] == 1){	
?>
	
<style>
 #logo_cond {
 position: absolute;
 top: 8px;
 left: 10px;
 }

 #condominio_nome {
 position: absolute;
 top: 8px;
 left: 70px;
 }
</style>
	
	<div id="logo_cond"><img src="css/logo.png" width="180"/></div>
	
<style>
ol, ul {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
  list-style: none;
}

.container {
  margin: 18px auto 20px;
  width: auto;
}

nav {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
  height: 26px;
  text-align: center;
}
nav ul {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
  border-width: 1px;
  border-style: solid;
  border-color: #d5d5d5 #d2d2d2 #cdcdcd;
  border-radius: 3px;
  display: inline-block;
  vertical-align: baseline;
  zoom: 1;
  *display: inline;
  *vertical-align: auto;
  -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}
nav li {
  float: left;
  border-left: 1px solid #d2d2d2;
  text-decoration: none;
  list-style-type:none;
}
nav li:first-child {
  border-left: 0;
  text-decoration: none;
  list-style-type:none;
}
nav li:first-child a {
  border-radius: 3px 0 0 3px;
  text-decoration: none;
  list-style-type:none;
}
nav li:last-child a {
  border-radius: 0 3px 3px 0;
}
nav a {
  display: block;
  position: relative;
  padding: 0 14px;
  height: 26px;
  line-height: 26px;
  font-size: 11px;
  font-weight: bold;
  color: #666;
  text-decoration: none;
  text-shadow: 0 1px white;
  background: #fafafa;
  background-image: -webkit-linear-gradient(top, #fcfcfc, #f0f0f0);
  background-image: -moz-linear-gradient(top, #fcfcfc, #f0f0f0);
  background-image: -o-linear-gradient(top, #fcfcfc, #f0f0f0);
  background-image: linear-gradient(to bottom, #fcfcfc, #f0f0f0);
  -webkit-box-shadow: inset 0 0 0 1px #fafafa;
  box-shadow: inset 0 0 0 1px #fafafa;
}
nav a:hover {
  color: #333;
  z-index: 2;
  -webkit-box-shadow: inset 0 0 0 1px #fafafa, 0 0 3px rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 0 0 1px #fafafa, 0 0 3px rgba(0, 0, 0, 0.3);
  text-decoration: none;
  list-style-type:none;
}
nav li.active a, nav a:active {
  color: #333;
  background: white;
  -webkit-box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1);
  box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1);
  list-style-type:none;
}
nav .badge {
  display: block;
  position: absolute;
  top: -12px;
  right: 3px;
  line-height: 16px;
  height: 16px;
  padding: 0 5px;
  font-family: Arial, sans-serif;
  color: white;
  text-shadow: 0 1px rgba(0, 0, 0, 0.25);
  border: 1px solid;
  border-radius: 10px;
  -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 1px rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.3), 0 1px 1px rgba(0, 0, 0, 0.08);
}
nav .badge {
  background: #67c1ef;
  border-color: #30aae9;
  background-image: -webkit-linear-gradient(top, #acddf6, #67c1ef);
  background-image: -moz-linear-gradient(top, #acddf6, #67c1ef);
  background-image: -o-linear-gradient(top, #acddf6, #67c1ef);
  background-image: linear-gradient(to bottom, #acddf6, #67c1ef);
}
nav .badge.green {
  background: #77cc51;
  border-color: #59ad33;
  background-image: -webkit-linear-gradient(top, #a5dd8c, #77cc51);
  background-image: -moz-linear-gradient(top, #a5dd8c, #77cc51);
  background-image: -o-linear-gradient(top, #a5dd8c, #77cc51);
  background-image: linear-gradient(to bottom, #a5dd8c, #77cc51);
}
nav .badge.yellow {
  background: #faba3e;
  border-color: #f4a306;
  background-image: -webkit-linear-gradient(top, #fcd589, #faba3e);
  background-image: -moz-linear-gradient(top, #fcd589, #faba3e);
  background-image: -o-linear-gradient(top, #fcd589, #faba3e);
  background-image: linear-gradient(to bottom, #fcd589, #faba3e);
}
nav .badge.red {
  background: #fa623f;
  border-color: #fa5a35;
  background-image: -webkit-linear-gradient(top, #fc9f8a, #fa623f);
  background-image: -moz-linear-gradient(top, #fc9f8a, #fa623f);
  background-image: -o-linear-gradient(top, #fc9f8a, #fa623f);
  background-image: linear-gradient(to bottom, #fc9f8a, #fa623f);
}


<!-- pesquisa -->

.container2 {
  margin: 50px auto;
  width: 20px;
}

input {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #555860;
}

.search {
  position: relative;
  margin: 0 auto;
  width: 410px;
}
.search input {
  height: 26px;
  width: 100%;
  padding: 0 12px 0 25px;
  background: white url("img/search.png") 8px 6px no-repeat;
  border: 1px solid;
  border-color: #a8acbc #babdcc #c0c3d2;
  border-radius: 13px;
  -webkit-appearance: textfield;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  -webkit-box-shadow: inset 0 1px #e5e7ed, 0 1px #fcfcfc;
  box-shadow: inset 0 1px #e5e7ed, 0 1px #fcfcfc;
}
.search input:focus {
  outline: 0;
  border-color: #66b1ee;
  -webkit-box-shadow: 0 0 2px rgba(85, 168, 236, 0.9);
  box-shadow: 0 0 2px rgba(85, 168, 236, 0.9);
}
.search input:focus + .search-ac {
  display: block;
}

.search-ac {
  display: none;
  position: absolute;
  top: 35px;
  left: 0;
  right: 0;
  z-index: 10;
  background: #fdfdfd;
  border: 1px solid;
  border-color: #cbcfe2 #c8cee7 #c4c7d7;
  border-radius: 3px;
  background-image: -webkit-linear-gradient(top, #fdfdfd, #eceef4);
  background-image: -moz-linear-gradient(top, #fdfdfd, #eceef4);
  background-image: -o-linear-gradient(top, #fdfdfd, #eceef4);
  background-image: linear-gradient(to bottom, #fdfdfd, #eceef4);
  -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.search-ac li {
  display: block;
}
.search-ac li:first-child {
  margin-top: -1px;
}
.search-ac li:first-child:before, .search-ac li:first-child:after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  position: absolute;
  left: 50%;
  ;
  border: 5px outset transparent;
}
.search-ac li:first-child:before {
  border-bottom: 5px solid #c4c7d7;
  top: -11px;
}
.search-ac li:first-child:after {
  border-bottom: 5px solid #fdfdfd;
  top: -10px;
}
.search-ac li:first-child:hover:before, .search-ac li:first-child:hover:after {
  display: none;
}
.search-ac li:last-child {
  margin-bottom: -1px;
}
.search-ac a {
  display: block;
  position: relative;
  margin: 0 -1px;
  padding: 6px 40px 6px 10px;
  color: #808394;
  font-weight: 500;
  text-decoration: none;
  text-shadow: 0 1px white;
  border: 1px solid transparent;
  border-radius: 3px;
}
.search-ac a span {
  font-weight: 200;
}
.search-ac a:before {
  content: '';
  position: absolute;
  top: 50%;
  right: 10px;
  margin-top: -9px;
  width: 18px;
  height: 18px;
  background: url("img/arrow.png") 0 0 no-repeat;
}
.search-ac a:hover {
  color: white;
  text-shadow: 0 -1px rgba(0, 0, 0, 0.3);
  background: #338cdf;
  border-color: #2380dd #2179d5 #1a60aa;
  background-image: -webkit-linear-gradient(top, #59aaf4, #338cdf);
  background-image: -moz-linear-gradient(top, #59aaf4, #338cdf);
  background-image: -o-linear-gradient(top, #59aaf4, #338cdf);
  background-image: linear-gradient(to bottom, #59aaf4, #338cdf);
  -webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 1px rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 1px rgba(0, 0, 0, 0.08);
}

:-moz-placeholder {
  color: #a7aabc;
  font-weight: 200;
}

::-webkit-input-placeholder {
  color: #a7aabc;
  font-weight: 200;
  line-height: 14px;
}

::-webkit-search-decoration,
::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.lt-ie9 .search input {
  line-height: 26px;
}

.target {
  border: solid 1px #aaa;
  min-height: 180px;
  width: 450px;
  margin-top: 1em;
  margin-bottom: -13em;
  border-radius: 5px;
  cursor: pointer;
  transition: 500ms all;
  position: relative;
}

.active {
  box-shadow: 0px 0px 5px 5px rgba(0,0,245,.2);
}
</style>

	<br /><br /><br />
      </ul>
    </nav>
  </section>
  
  <style>
   #pesquisa{
    position: absolute;
    top: 18px;
	right: 40px;
   }
  </style>
  
  <div id="pesquisa" style="position:absolute; left:0%; top:22px;">
  <section class="container2">
    <form class="search" method="post" action="search_pecas.php">
      <input name="pesquisa" type="search" placeholder="Digite algo para pesquisar..." autocomplete="off">
    </form>
  </section>
  </div>
	
	<div id="header-box"> <style> .senha{width:150px; height:45px; background:url('menu/icon-16-viewsite.png') no-repeat; background-position:3px;}  .logout{width:90px; height:45px; background:url('menu/icon-16-logout.png') no-repeat; background-position:3px;} </style> <a href="#" onclick="window.open('updateSenha.php', 'Alterar Senha', 'STATUS=NO, TOOLBAR=NO, LOCATION=NO, DIRECTORIES=NO, RESISABLE=NO, SCROLLBARS=YES, TOP=50%, LEFT=50%, WIDTH=1000, HEIGHT=500');"> <div class="senha" id="senha" style="position:absolute; top:10px; right:110px; cursor:pointer; border:1px solid #aaa; border-radius:10px;"> <p style="margin-left:50px; margin-top:12px;">Alterar Senha</p> </div> </a> <a href="logout.php" style="font-style:Arial; font-size:14px; color:#777; link-style:none;"> <div class="logout" id="logout" style="position:absolute; top:10px; right:10px; cursor:pointer; border:1px solid #aaa; border-radius:10px;"> <p style="margin-left:50px; margin-top:12px;">Sair</p> </div> </a>
		<div id="module-menu">
			<ul id="menu" >
				<li class="node"><a href="dashboard.php">Página Inicial</a></li>
				<li class="node"><a href="abreChamado.php">Abrir Chamado</a></li>
				<li class="node"><a href="chamados.php">Pesquisar Chamados</a></li>
				<li class="node"><a href="inventarios.php">Inventários</a></li>
				<li class="node"><a href="ramais.php">Lista de Ramais</a></li>
				<li class="node"><a href="user.php">Usuários</a></li>
				<li class="node"><a href="relatorios.php">Relatórios</a></li>
			</ul>
		</div>
		<div id="module-status">
			
			
			</div>
		<div class="clr"></div>
	</div>

	<div id="content-box">
		<div id="toolbar-box">
			<div class="m">
				
	<div class="pagetitle icon-48-cadastro"><h2>Abertura de Chamado</h2></div>
	</div>
	</div>
									
<div id="system-message-container">
</div>
		<div id="element-box">
			<div class="m">
	
<form action="sql/insert/insertChamados.php" method="post" enctype="multipart/form-data">
<fieldset class="batch">
	<legend>Abertura de Chamado</legend>
	<p>
		<input type="text" name="titulo" method="post" size="70" placeholder="Título"/><br /><br />
		<textarea cols="56" rows="5" name="desc" onkeyup="Contar(this)" placeholder="Descrição"></textarea>
		<br /><br /><br /><br /><br />
		<div id="Qtd">1000 caracteres restantes.</div>
		<br />
		<select name="prioridade">
			<option value="Selecione um nivel de prioridade">Selecione um nível de prioridade</option>
			<option>Baixa</option>
			<option>Media</option>
			<option>Alta</option>
			<option>Urgente</option>
		</select><br /><br />
		
		<input type="file" name="arquivo" id="arquivo"/><br /><br />
		
		<script>
		function hide(target){
			document.getElementById("paragrafo").style.display = 'none';
			document.getElementById("image").style.display = 'none';
			document.getElementById("image2").style.display = 'none';
		}
		</script>
		
		<div class="container fluid"> 
			<div class="row">
				<div class="span4 target" onclick="hide('image')">
					<p style="margin-top:30px;" id="paragrafo">Clique aqui e aperte CTRL + V para anexar uma imagem</p><br />
					<div align="center" style="z-index:-1;">
						<img src="images/pictures.png" id="image" style="margin-top:-30px; margin-left:110px; width:20%; z-index:-1;" />
						<img src="images/pictures2.png" id="image2" style="margin-top:-30px; margin-left:40px; width:20%; z-index:-1;" />
					</div>
				</div>
			</div>

			<div class="span12">
				<textarea name="texto" id="texto" style="visibility: hidden;" cols="30" rows="10" class="data span12"></textarea>
			</div>
			
			
		</div>
		
		
	</p>
</fieldset>
	<input type="submit" formaction="sql/insert/insertChamados.php" id="test" name="test" enctype="multipart/form-data" value="Cadastrar"/>
	<button type="reset">Limpar Campos</button>
</fieldset>
</form>

		<div class="clr"></div>
		</div>
		</div>
		<noscript>
			Atenção! JavaScript deve estar habilitado para o bom funcionamento do sistema.	</noscript>
	</div>
<?php } else { echo '<script language="javascript">location.href="../index.php";</script>';} ?>
</body>
</html>
insertChamados.php

<?php
include 'abreConexao.php';
session_start();

	date_default_timezone_set('America/Sao_Paulo');

	$titulo = $_POST['titulo'];
	$desc = $_POST['desc'];
	$prioridade = $_POST['prioridade'];
	
	$ip = $_SESSION['ip'];
	$ramal = $_SESSION['ramal'];
	$usuario = $_SESSION['nome'];
	$setor = $_SESSION['setor'];
	
	$data_aux = date("d-m-Y");
	$data = date("Y-m-d", strtotime($data_aux));
	$hora = date('H:i:s');

    if($titulo != "" && $desc != "" && $prioridade != "Selecione um nivel de prioridade"){
		$sql2 = "INSERT INTO chamados (titulo, descricao, prioridade, ip, usuario, setor, dt, hora, ramal)";
		$sql2 .= " VALUES('$titulo', '$desc', '$prioridade', '$ip', '$usuario', '$setor', '$data', '$hora', '$ramal')";
		mysql_query($sql2) or die(mysql_error());//execuando INSERT 
	
		$ultimo_id = mysql_insert_id();
		
		$_SESSION['ultimo_chamado'] = $ultimo_id;
		$_SESSION['ultimo_chamado_titulo'] = $titulo;
		$_SESSION['ultimo_chamado_data'] = $data_aux;
		$_SESSION['ultimo_chamado_hora'] = $hora;
		
		$url = "../../uploads/chamados/"; //caminho onse ser? salvo os arquivos
		$carregar = $_FILES['arquivo']['tmp_name']; //arquivo temporario
		$novo_nome = $ultimo_id.strrchr($_FILES['arquivo']['name'], '.'); //criamos uma variavel com o novo nome
		$extensao = strrchr($_FILES['arquivo']['name'], '.');
		
		$corte = explode(".", $novo_nome);
		
		$img = $_POST['texto'];
		$extension = ".png";
		$filename = $ultimo_id.$extension;
		file_put_contents('../../uploads/chamados/'.$filename, file_get_contents($img));
		
		$sql5 = "INSERT INTO anexos_chamados (nome, extensao)";
		$sql5 .= " VALUES('".$ultimo_id."', 'png')";
		mysql_query($sql5) or die(mysql_error());//execuando INSERT
		
		
		if(move_uploaded_file($carregar,$url.$novo_nome)){   //copia o arquivo do computador para o servidor
			rename($url.$carregar, $url.$novo_nome);//renomeia o arquivo
			$sql4 = "INSERT INTO anexos_chamados (nome, extensao)";
			$sql4 .= " VALUES('".$ultimo_id."', '".$corte[1]."')";
			mysql_query($sql4) or die(mysql_error());//execuando INSERT
		}

		print '<script>window.alert("Chamado cadastrado com sucesso ! N? OS.: '.$ultimo_id.'");</script>';
		print '<script>window.top.location.href = "'. "resposta/email_search.php" .'";</script>';
	} else {
		print '<script>window.alert("Por favor, preencha todos os campos !");</script>';
		print '<script>history.back();</script>';
	}
?>
paste_image.js

// Created by STRd6
// MIT License
// jquery.paste_image_reader.js
(function($) {
  var defaults;
  $.event.fix = (function(originalFix) {
    return function(event) {
      event = originalFix.apply(this, arguments);
      if (event.type.indexOf('copy') === 0 || event.type.indexOf('paste') === 0) {
        event.clipboardData = event.originalEvent.clipboardData;
      }
      return event;
    };
  })($.event.fix);
  defaults = {
    callback: $.noop,
    matchType: /image.*/
  };
  return $.fn.pasteImageReader = function(options) {
    if (typeof options === "function") {
      options = {
        callback: options
      };
    }
    options = $.extend({}, defaults, options);
    return this.each(function() {
      var $this, element;
      element = this;
      $this = $(this);
      return $this.bind('paste', function(event) {
        var clipboardData, found;
        found = false;
        clipboardData = event.clipboardData;
        return Array.prototype.forEach.call(clipboardData.types, function(type, i) {
          var file, reader;
          if (found) {
            return;
          }
          if (type.match(options.matchType) || clipboardData.items[i].type.match(options.matchType)) {
            file = clipboardData.items[i].getAsFile();
            reader = new FileReader();
            reader.onload = function(evt) {
              return options.callback.call(element, {
                dataURL: evt.target.result,
                event: evt,
                file: file,
                name: file.name
              });
            };
            reader.readAsDataURL(file);
            snapshoot();
            return found = true;
          }
        });
      });
    });
  };
})(jQuery);



$("html").pasteImageReader(function(results) {
  var dataURL, filename;
  filename = results.filename, dataURL = results.dataURL;
  $data.text(dataURL);
  $size.val(results.file.size);
  $type.val(results.file.type);
  $test.attr('href', dataURL);
  var img = document.createElement('img');
  img.src= dataURL;
  var w = img.width;
  var h = img.height;
  $width.val(w)
  $height.val(h);
  return $(".active").css({
    backgroundImage: "url(" + dataURL + ")"
  }).data({'width':w, 'height':h});
});

var $data, $size, $type, $test, $width, $height;
$(function() {
  $data = $('.data');
  $size = $('.size');
  $type = $('.type');
  $test = $('#test');
  $width = $('#width');
  $height = $('#height');
  $('.target').on('click', function() {
    var $this = $(this);
    var bi = $this.css('background-image');
    if (bi!='none') {
        $data.text(bi.substr(4,bi.length-6));
    }
                    
                    
    $('.active').removeClass('active');
    $this.addClass('active');
    
    $this.toggleClass('contain');
    
    $width.val($this.data('width'));
    $height.val($this.data('height'));
    if ($this.hasClass('contain')) {
      $this.css({'width':$this.data('width'), 'height':$this.data('height'), 'z-index':'10'})
    } else {
      $this.css({'width':'', 'height':'', 'z-index':''})
    }
    
  })
})

 

Obrigado desde já.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Cara você simplesmente colou um monte de código, sem dizer o que quer que ele faça, nem disse o problema,

não deu detalhes nenhum

vai ser difícil alguém te ajudar

Compartilhar este post


Link para o post
Compartilhar em outros sites

Bom dia Eletronic.

Este código tem a finalidade de abrir chamados técnicos, e o mesmo é realmente extenso.

 

Eu estou utilizando um javascript que tem a função de receber prints e outra página "insertChamados" para realizar um upload através da URL.

 

Na minha máquina local ao clicar no botão "Cadastrar", salva o print na pasta desejada, porém no UOL HOST não faz o UPLOAD pela URL, entendeu ?

 

Por qual motivo pode não estar dando certo ?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Aperte Ctrl + Shift + J e veja se aparece algo no console de erros.

 

Se não aparecer nada, então o seu problema é server-side.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Confere se vc enviou todos os arquivos pro servidor.

Poste o link para analisarmos.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Erro 500. Seu problema é server-side.

 

Poste em PHP.

Compartilhar este post


Link para o post
Compartilhar em outros sites

<?php
include 'abreConexao.php';
session_start();

	date_default_timezone_set('America/Sao_Paulo');

	$titulo = $_POST['titulo'];
	$desc = $_POST['desc'];
	$prioridade = $_POST['prioridade'];
	
	$ip = $_SESSION['ip'];
	$ramal = $_SESSION['ramal'];
	$usuario = $_SESSION['nome'];
	$setor = $_SESSION['setor'];
	
	$data_aux = date("d-m-Y");
	$data = date("Y-m-d", strtotime($data_aux));
	$hora = date('H:i:s');

    if($titulo != "" && $desc != "" && $prioridade != "Selecione um nivel de prioridade"){
		$sql2 = "INSERT INTO chamados (titulo, descricao, prioridade, ip, usuario, setor, dt, hora, ramal)";
		$sql2 .= " VALUES('$titulo', '$desc', '$prioridade', '$ip', '$usuario', '$setor', '$data', '$hora', '$ramal')";
		mysql_query($sql2) or die(mysql_error());//execuando INSERT 
	
		$ultimo_id = mysql_insert_id();
		
		$_SESSION['ultimo_chamado'] = $ultimo_id;
		$_SESSION['ultimo_chamado_titulo'] = $titulo;
		$_SESSION['ultimo_chamado_data'] = $data_aux;
		$_SESSION['ultimo_chamado_hora'] = $hora;
		
		$url = "../../uploads/chamados/"; //caminho onse ser? salvo os arquivos
		$carregar = $_FILES['arquivo']['tmp_name']; //arquivo temporario
		$novo_nome = $ultimo_id.strrchr($_FILES['arquivo']['name'], '.'); //criamos uma variavel com o novo nome
		$extensao = strrchr($_FILES['arquivo']['name'], '.');
		
		$corte = explode(".", $novo_nome);
		
		$img = $_POST['texto'];
		$extension = ".png";
		$filename = $ultimo_id.$extension;
		file_put_contents('../../uploads/chamados/'.$filename, file_get_contents($img));
		
		$sql5 = "INSERT INTO anexos_chamados (nome, extensao)";
		$sql5 .= " VALUES('".$ultimo_id."', 'png')";
		mysql_query($sql5) or die(mysql_error());//execuando INSERT
		
		
		if(move_uploaded_file($carregar,$url.$novo_nome)){   //copia o arquivo do computador para o servidor
			rename($url.$carregar, $url.$novo_nome);//renomeia o arquivo
			$sql4 = "INSERT INTO anexos_chamados (nome, extensao)";
			$sql4 .= " VALUES('".$ultimo_id."', '".$corte[1]."')";
			mysql_query($sql4) or die(mysql_error());//execuando INSERT
		}

		print '<script>window.alert("Chamado cadastrado com sucesso ! N? OS.: '.$ultimo_id.'");</script>';
		print '<script>window.top.location.href = "'. "resposta/email_search.php" .'";</script>';
	} else {
		print '<script>window.alert("Por favor, preencha todos os campos !");</script>';
		print '<script>history.back();</script>';
	}
?>

Suspeito que tenha dado erro nesta parte do código, porém no meu servidor local funciona normalmente

$img = $_POST['texto'];
		$extension = ".png";
		$filename = $ultimo_id.$extension;
		file_put_contents('../../uploads/chamados/'.$filename, file_get_contents($img));

Posso lhe enviar o código por e-mail ?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Não cara, não adianta enviar por email.

 

Procure o log de erros do apache e veja lá o motivo de estar dando 500.

Compartilhar este post


Link para o post
Compartilhar em outros sites

E quando vc tenta colar via Ctrl + V, o que aparece no console de erros ?

Compartilhar este post


Link para o post
Compartilhar em outros sites

E onde vc supostamente declara a função snapshoot(); ?

 

Não está em nenhum dos códigos q vc postou aqui.

Compartilhar este post


Link para o post
Compartilhar em outros sites
// Created by STRd6
// MIT License
// jquery.paste_image_reader.js
(function($) {
  var defaults;
  $.event.fix = (function(originalFix) {
    return function(event) {
      event = originalFix.apply(this, arguments);
      if (event.type.indexOf('copy') === 0 || event.type.indexOf('paste') === 0) {
        event.clipboardData = event.originalEvent.clipboardData;
      }
      return event;
    };
  })($.event.fix);
  defaults = {
    callback: $.noop,
    matchType: /image.*/
  };
  return $.fn.pasteImageReader = function(options) {
    if (typeof options === "function") {
      options = {
        callback: options
      };
    }
    options = $.extend({}, defaults, options);
    return this.each(function() {
      var $this, element;
      element = this;
      $this = $(this);
      return $this.bind('paste', function(event) {
        var clipboardData, found;
        found = false;
        clipboardData = event.clipboardData;
        return Array.prototype.forEach.call(clipboardData.types, function(type, i) {
          var file, reader;
          if (found) {
            return;
          }
          if (type.match(options.matchType) || clipboardData.items[i].type.match(options.matchType)) {
            file = clipboardData.items[i].getAsFile();
            reader = new FileReader();
            reader.onload = function(evt) {
              return options.callback.call(element, {
                dataURL: evt.target.result,
                event: evt,
                file: file,
                name: file.name
              });
            };
            reader.readAsDataURL(file);
            snapshoot();
            return found = true;
          }
        });
      });
    });
  };
})(jQuery);



$("html").pasteImageReader(function(results) {
  var dataURL, filename;
  filename = results.filename, dataURL = results.dataURL;
  $data.text(dataURL);
  $size.val(results.file.size);
  $type.val(results.file.type);
  $test.attr('href', dataURL);
  var img = document.createElement('img');
  img.src= dataURL;
  var w = img.width;
  var h = img.height;
  $width.val(w)
  $height.val(h);
  return $(".active").css({
    backgroundImage: "url(" + dataURL + ")"
  }).data({'width':w, 'height':h});
});

var $data, $size, $type, $test, $width, $height;
$(function() {
  $data = $('.data');
  $size = $('.size');
  $type = $('.type');
  $test = $('#test');
  $width = $('#width');
  $height = $('#height');
  $('.target').on('click', function() {
    var $this = $(this);
    var bi = $this.css('background-image');
    if (bi!='none') {
        $data.text(bi.substr(4,bi.length-6));
    }
                    
                    
    $('.active').removeClass('active');
    $this.addClass('active');
    
    $this.toggleClass('contain');
    
    $width.val($this.data('width'));
    $height.val($this.data('height'));
    if ($this.hasClass('contain')) {
      $this.css({'width':$this.data('width'), 'height':$this.data('height'), 'z-index':'10'})
    } else {
      $this.css({'width':'', 'height':'', 'z-index':''})
    }
    
  })
})

Está aqui cara ...

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.