Hola que tal, les cuento, ando haciendole unas modificaciones al script de
Pato12, entre las modificaciones que ando haciendo unas es poder subir una imagen desde una url externa y que se procese en el archivo upload.php, modificando el type="file" por un type="text" para poner escribir la url.
mi pregunta es: ¿Como podria adaptar el formulario para poder subir imagenes examinandolas desde la Pc y con un link de una iamgen?
Pongo el codigo del
index.php que es desde donde se envia la imagen y
upload.php que es donde se procesa el archivo enviado mediante post.
index.php
Código HTML:
Ver original<form action="upload.php" method="post" enctype="multipart/form-data"> Archivo:
<input name="file" id="input-file" type="file" /><br>
<input type="checkbox" name="checktitle" id="checkalt" onclick="if(this.checked==false)this.form.addtitle.disabled=true;else this.form.addtitle.disabled=false" />Agregar titulo:
<input type="text" name="addtitle" id="addtitle" disabled="disabled" /><br>
<input type="checkbox" name="checklink" id="checklink" onclick="if(this.checked==false)this.form.addlink.disabled=true;else this.form.addlink.disabled=false" />Agregar v
ínculo: http://
<input type="text" name="addlink" id="addlink" disabled="disabled" /><br>
Por seguridad, escriba el texto que se muestra en la imagen:
<br> <input name="tmptxt" type="text" maxlength="8" /> <img src="captcha.php" id="captcha" vspace="3" /> <input type="button" id="reload-captcha" title="Recargar captcha" onClick="reloadCaptcha()" /><br> <span id="span-captcha">Sensible entre may
úsculas y min
úsculas.
</span><br>
<input name="submit" type="submit" value="Upload!" />
upload.php
Código PHP:
Ver original<?php
if($_POST)
{
if($_SESSION[tmptxt] == $_POST[tmptxt])
{
$key = "si";
}
else
{
echo "El codigo antispam esta mal.";
}
}
if($key == "si")
{
$str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
$cad = "";
for($i = 0; $i < 12; $i ++)
{
}
$size = $_FILES[file][size
]; $size_max = "3670016"; //3.5 MB
if($size < $size_max)
{
$destino = "img";
$tipo = $sep[1];
if($tipo == "png" || $tipo == "x-png" || $tipo == "gif" || $tipo == "jpeg" || $tipo == "pjpeg" || $tipo == "bmp")
{
include("post.php");
}
else echo "El tipo de imagen no esta permitido.";
}
else echo "La imagen supera el peso permitido.";
}
?>
Saludos y gracias de antemano