Ver Mensaje Individual
  #6 (permalink)  
Antiguo 02/02/2007, 07:22
Avatar de Marvin
Marvin
Colaborador
 
Fecha de Ingreso: febrero-2005
Ubicación: global $Chile->Santiago;
Mensajes: 1.991
Antigüedad: 19 años, 3 meses
Puntos: 81
Re: Enviar archivos al servidor

Lo saque de php.net:

Español (o algo cercano):
Cita:
Para aquellos que estan trantando de subir archivos con IIS en win xp/2000/xp media y parecidos, aqui hay una lista rapida.

1) Una vez que has creado el subdirectorio "uploads/" en el mismo directorio donde tu codigo esta corriendo, usa el codigo de oportocala y trata de estar absolutamente seguro que el archivo que estas buscando esta en esa carpeta. (Recomiendo mostrar el archivo con echo $uploadfile;)

Cita:
Iniciado por codigo de oportocala
<?php

$name_tmp = $HTTP_POST_FILES['file']['tmp_name'];
//read temporay filename
$name = $HTTP_POST_FILES['file']['name'];
//read initial filename
if(is_uploaded_file($name_tmp)){
$ext =explode('.', $name);
$ext = $ext[count($ext)-1];
//get extension of uploaded file
$index=getLastIndex();//costum function
$path_parts = pathinfo(__file__);//get path info of curent php script
$dir = $path_parts['dirname']."\\uploads"; //full path of upload directory
$new = $dir."\\".$index.".".$ext;
if(move_uploaded_file($name_tmp,$new))
echo "File transfer succesfull.";
}

?>
2) En windows explorer busca el directorio uploads y compartelo. Para hacer esto haz lo siguiente:
a) Click derecho en la carpeta y "compartir y seguridad..."
b) Activa "Compartir esta carpeta en la red"
c) Activa "Permitir que los usuarios de la red cambien mis archivos" (ESTE PASO ES MUY IMPORTANTE)
d) Click "OK" o "Aceptar"

3) Ahora puedes ir a IIS para setear los permisos de lectura y escritura. Para hacer esto has lo siguiente:
a) Abre IIS (Inicio/Panel de Control (vista clasica)/Herramientas Administrativas/Internet Information Service
b) Navega hasta tu carpeta (la que creamos)
c) Click derecho y selecciona Propiedades.
d) En la barra del directorio asegurate que Escribir, Leer y navegar el directorio estan chequeadas.
e) Para la loca seguridad de aqui, Debes estar tambien seguro que los 'permisos de ejecucion' estan seteados solo al script o algo (NO LO SETEES A 'ejecutable y script')(esto es porque alguien podria subir un script a tu directorio y ejecutarlo. Y chico, no quieres que eso pase).

ahi tienes.

Avisame si funciono o no asi puedo poner al dia la lista. (En ingles)

[email protected]

Pd: Muchas Gracias a oportocala
Original:
Cita:
Iniciado por jedi_aka at yahoo dot com
For those of you trying to make the upload work with IIS on windows XP/2000/XP Media and alike here is a quick todo.

1) Once you have created subdirectories "uploads/" in the same directory wher you code is running use the code from oportocala above and to make absolutely sure sure that the file you are trying to right is written under that folder. ( I recomend printing it using echo $uploadfile; )
Cita:
Iniciado por code from oportocala
<?php

$name_tmp = $HTTP_POST_FILES['file']['tmp_name'];
//read temporay filename
$name = $HTTP_POST_FILES['file']['name'];
//read initial filename
if(is_uploaded_file($name_tmp)){
$ext =explode('.', $name);
$ext = $ext[count($ext)-1];
//get extension of uploaded file
$index=getLastIndex();//costum function
$path_parts = pathinfo(__file__);//get path info of curent php script
$dir = $path_parts['dirname']."\\uploads"; //full path of upload directory
$new = $dir."\\".$index.".".$ext;
if(move_uploaded_file($name_tmp,$new))
echo "File transfer succesfull.";
}

?>
2) In windows explorer browse to the upload directory created above and share it. To do that execute the following substeps.
a) Right click the folder click "sharing and security..."
b) Check 'Share this folder on the network'
c) Check 'Allow network users to change my files' ( THIS STEP IS VERY IMPORTANT )
d) click 'ok' or 'apply'

3) you can then go in the IIS to set read and write permissions for it. To do that execute the followin substeps.
a) Open IIS (Start/Controp Panel (classic View)/ Admistrative tools/Internet Information Service
b) Browse to your folder (the one we created above)
c) right click and select properties.
d) in the Directory tab, make sure, READ, WRITE, AND DIRECTORY BROWSING are checked.
e) For the security freaks out there, You should also make sure that 'execute permissions:' are set to Script only or lower (DO NOT SET IT TO 'script and executable)'( that is because someone could upload a script to your directory and run it. And, boy, you do not want that to happen).

there U go.

Send me feed back it if worked for you or not so that I can update the todo.

[email protected]

PS: BIG thanks to oportocala