PHP - Problema con paso de vars

 
Vista:

Problema con paso de vars

Publicado por informagestudios (2 intervenciones) el 10/05/2006 03:17:01
Buenas gente:

Os comento, tengo este código, que se supone que me tiene que ir cambiando el value de un select, según el elemento que este seleccionado.
Bien, luego este value se lo añado a un <i>, y a un campo hidden(rutaphp).

El problema, es qu no me recoje el value de rutaphp en la variable $ruto, que es la que luego quiero utilizar para subir los archivos.

Digo esto, por que cuando hago el echo $ruto; solo me muestra /home/cmnghjuw/

Y cuando le doy a subir el archivo, me muestra esto:

Warning: move_uploaded_file(12.5.gif): failed to open stream: Permission denied in /home/cmnghjuw/public_html/gestionandoport.php on line 92

Warning: move_uploaded_file(): Unable to move '/tmp/phprFzwn8' to '12.5.gif' in /home/cmnghjuw/public_html/gestionandoport.php on line 92

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
function chg(campo) {
  with (campo.form) {
    var valor=carpetas.options[carpetas.selectedIndex].value;
    document.getElementById('ruta').innerHTML=valor;
        document.up.rutaphp.value=valor;
        }
}
 
if ($_GET['accion']=="") {
 
echo <<< HTML
 
        <table width='80%' border='0' cellspacing='0' cellpadding='0'>
        <form Enctype='Multipart/Form-Data' action='$pag?accion=subir' method='post' name='up'>
        <tr height='12'><td></td></tr>
        <tr height='20'><td align='left' class='texto' nowrap>Elija sección para subir las imágenes:
        <img src='Images/espacio.gif' width='10' height='1'>
        <select name='carpetas' class='casillas' onchange='chg(this)'>
        <option value='public_html/trabajos/grafico/'>Diseño Gráfico</option>
        <option value='public_html/trabajos/web/'>Diseño Web</option>
        <option value='public_html/trabajos/multimedia/'>Multimedia</option>
        <option value='public_html/trabajos/ilustracion/'>Ilustración</option>
        <option value='public_html/trabajos/infografia/'>Infografía</option>
        </select>
        </td>
        </tr>
        <tr height='30'><td></td></tr>
        <tr height='15'>
        <td>
        <span class='texto'>El directorio actual es: <i id=ruta></i></span>
        </td></tr>
        <tr height='30'><td><input type='hidden' name='rutaphp' id='rutaphp' value='public_html/trabajos/grafico/'></td></tr>
        <tr height='40'>
        <td>
        <span class='texto'>Imagen en pequeño: </span><img src='Images/espacio.gif' width='24' height='1'>
        <input name='archivopeque' type='file' id='archivopeque' class='casillas' style='cursor:pointer;'>
        </td></tr>
        <tr height='40'>
        <td>
        <span class='texto'>Imagen en grande: </span><img src='Images/espacio.gif' width='24' height='1'>
        <input name='archivogrande' type='file' id='archivogrande' class='casillas' style='cursor:pointer;'>
        </td></tr>
        <tr height='20'>
        <td align='left'>
        <input name='Submit' type='submit' value='Subir Archivo' class='botones' style='cursor:pointer;'>
        </td>
        </tr>
        </form>
        </table>
        <table width='80%' border='0' cellspacing='0' cellpadding='0'>
        <tr height='30' align='center'><td>
 
HTML;
 
$ruto = "/home/cmnghjuw/".$_POST['rutaphp'];
echo $ruto;
 
}
 
if ($_GET['accion']=="subir") {
 
        $lista = ftp_nlist($id_ftp,$ruto);
        $result = count($lista)-1;
        $nombrepeque = $result / 2;
 
        if ($nombrepeque%2==0) {
 
                $nombregrande = $nombrepeque."grande";
                $archivo_size_peque= $_FILES['archivopeque']['size'];
                $archivo_size_grande= $_FILES['archivogrande']['size'];
                $archivo_type_peque= $_FILES['archivopeque']['type'];
                $archivo_type_grande= $_FILES['archivogrande']['type'];
                $archivo_peque=$_FILES['archivopeque']['tmp_name'];
                $archivo_grande=$_FILES['archivogrande']['tmp_name'];
                $MAX_FILE_SIZE= 104857;
                $extension =".gif";
                $rutapeque = $ruto . $nombrepeque. $extension;
                $rutagrande = $ruto . $nombregrande. $extension;
 
                if ((!file_exists($rutapeque)) AND (!file_exists($rutagrande))) {
 
                        if (($archivo_type_peque=="image/gif") || ($archivo_type_peque=="image/pjpeg")) {
 
                                if (($archivo_type_grande=="image/gif") || ($archivo_type_grande=="image/pjpeg")) {
 
                                        if (($archivo_peque != "") AND ($archivo_peque != "none") AND ($archivo_size_peque != 0) AND ($archivo_size_peque<=$MAX_FILE_SIZE)) {
 
                                                if (($archivo_grande != "") AND ($archivo_grande != "none") AND ($archivo_size_grande != 0) AND ($archivo_size_grande<=$MAX_FILE_SIZE)) {
 
                                                        if(move_uploaded_file($archivo_peque, $rutapeque)) {
 
                                                         if(move_uploaded_file($archivo_grande, $rutagrande)) {
 
                                                                echo "<div align='center' class='rojo'>Archivos <strong>" . $nombrepeque .$extension. " y " . $nombregrande .$extension. "</strong> subidos.</div>";
                                                                echo "</td></tr>";
                                                                echo "<tr>";
                                                                echo "<td align='center'>";
                                                                unset($_FILES["archivopeque"]);
                                                                unset($_FILES["archivogrande"]);
 
                                                         }else{
 
                                                                echo "<div align='center' class='rojo'>Imposible subir <strong>" . $nombrepeque .$extension. " y " . $nombregrande.$extension."</strong></div>";
                                                                echo "</td></tr>";
                                                                echo "<tr>";
                                                                echo "<td align='center'>";
 
                                                         }
 
                                                        }
 
                                                }
 
                                        }
 
                                }
 
                        }
 
                }else{
 
                        echo "<div align='center' class='rojo'>Imposible subir <strong>" . $nombrepeque . " y " . $nombregrande." porque ya existen con ese nombre.</strong></div>";
                        echo "</td></tr>";
                        echo "<tr>";
                        echo "<td align='center'>";
 
                }
 
        }else{
 
                        echo "<div align='center' class='rojo'>Imposible subir <strong>" . $nombrepeque .$extension. " y " . $nombregrande.$extension."</strong></div>";
                        echo "</td></tr>";
                        echo "<tr>";
                        echo "<td align='center'>";
 
        }
 
}
 
echo "<input name='Volver' type='submit' value='Volver' class='botones' style='cursor:pointer;' OnClick='history.back()'>";
echo "</td></tr>";
echo "</table>";
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder