http://blog.unijimpe.net/hosting-de-imagenes-en-php/
El código me quedo así tal cual:
Código 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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data">
<input name="imagen" type="file" size="35" />
<input name="enviar" type="submit" value="Upload Image" />
<input name="action" type="hidden" value="upload" />
</form>
<?php
$varrand = substr(md5(uniqid(rand())),0,10);
$varallw = array("image/bmp","image/gif","image/jpeg","image/pjpeg","image/png","image/x-png");
$varpath = "http://habbotools.com.ar/imagehosting.php?image=";
$varstat = "";
if (is_uploaded_file($_FILES["imagen"]["tmp_name"])) {
$varname = $_FILES["imagen"]['name'];
$vartemp = $_FILES['imagen']['tmp_name'];
$vartype = mime_content_type($vartemp);
if (in_array($vartype, $varallw) && $varname != "") {
$arrname = explode(".", $varname);
$varname = $varrand.".".$arrname[1];
if (copy($vartemp, "tmp/".$varname)) {
$varpath = $varpath.$varname;
$varstat = "ok";
} else {
$varstat = "Error al subir el archivo";
}
} else {
$varstat = "Archivo no valido";
}
}
?>
<?php if ($varstat == "ok") { ?>
<strong>Confirmacion:</strong><br>
Archivo publicado satisfactoriamente.
Puedes utilizar las siguientes opciones para enlazarlo:<br>
<strong>Enlace Directo: </strong><br>
<input name="txt2" type="text" value="<?php echo $varpath; ?>">
<img src="tmp/<?php echo $varname; ?>">
<?php } ?>
<?php if ($_GET['image'] != "") { ?>
<img src="tmp/<?php echo $_GET['image']; ?>">
<?php } ?>
</body>
</html>
Fatal error: Call to undefined function: mime_content_type() in /home/manumaf/domains/habbotools.com.ar/public_html/img/imagehosting.php on line 23
La linea 23 es lo siguiente:
Código PHP:
$vartype = mime_content_type($vartemp);
Por si hace falta el archivo esta en la siguiente ruta
/home/manumaf/domains/habbotools.com.ar/public_html/img/imagehosting.php
Según el código las imágenes se guardan en una carpeta tmp a la cual ya le di permisos de escritura 777.
Bueno el que me arregle esto le doy un premio jeje no pero por favor alguien que me ayude que lo necesito pronto a esto.
Saludos!