-1

我正在使用这个类: http: //php.developpez.com/telecharger/detail/id/2944/Classe-d-upload-de-fichiers-avec-options-de-redimensionnement-renommage-gestion-des-erreurs

当我使用以下代码时:

$repertoire_destination = strtolower($_SESSION['login']);

 //Déclaration de la classe
 $up = new Telechargement($repertoire_destination,'form1','file','controle_form');

 //Extensions autorisées (sans les .)
 $extensions = array("gif","png","jpg","jpeg");
 $up->Set_Extensions_accepte ($extensions);

 $name_fichier = uniqid($_SESSION['login']);
 // Rennommage des fichiers (en mode incrémentiel) si déjà présents sur le serveur.
 $up->Set_Nomme_fichier($name_fichier,pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION));
 $up->Set_Renomme_fichier($name_fichier);

 $up->Set_Redim ('1920','1200');
 $up->Set_Redim ('160','100','upload/'.strtolower($_SESSION['login']).'/thumb');


 // Téléchargement
 $up->Upload();

上传的文件必须保存在目录中: strtolower($_SESSION['login']); 其中$_SESSION['login'])包含用户的名称。

但不幸的是,它发送了一个空值。

当我以后使用时:

$up->Set_Redim ('160','100','upload/'.strtolower($_SESSION['login']).'/thumb');

$_SESSION['login'])包含username. _

谁能帮我解决这个问题?

4

1 回答 1

0

session_start(); must be present/included in all the .php files if using sessions.

Plus it needs to be at the very top (most of the time), underneath your opening PHP tag <?php.

This is often overlooked.

More information about sessions can be found on the PHP.net Web site by going to the following link.

http://php.net/manual/en/function.session-start.php

于 2013-06-21T13:40:50.870 回答