¿Cómo almacena los archivos cargados en su servidor?

How to store downloaded files on a server, for example in the script Download Center? In what ways do you store uploaded files? Add to that name, which create a folder? Sorry for English.

preguntado el 09 de marzo de 12 a las 16:03

Can you tell us more details please ... ? -

For example: home/files/$date/$IdCategory_$rand_$name.gif -

For example, some every thousand files make a new folder, not to store many files in one folder. So I ask that you undertake? -

@user1233943: Why does it matter if there are more than one thousand files in one folder? -

To search was carried out quickly. So I was wondering how to best sort and store in order to increase productivity -

1 Respuestas

Deberías leer sobre PHP: Handling file uploads desde PHP.net.

$date = date("Ymd");
$rand = uniqid();
$uploaddir = "/home/files/{$date}/";
$uploadfile = $uploaddir . $IdCategory . '_' . $rand . '_' . basename($_FILES['userfile']['name']);

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    echo "File is valid, and was successfully uploaded.";
} else {
    echo "Upload did not succeed.";
}

respondido 09 mar '12, 17:03

For example, some every thousand files make a new folder, not to store many files in one folder. So I ask that you undertake? - user1233943

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.