Salut merci de m'aider! bon je te mets le code php:
<?php error_reporting(-1)?>
<?php
// ---------------------------------------------
// Pure PHP Upload version 1.1
// -------------------------------------------
if (phpversion() > "4.0.6") {
$HTTP_POST_FILES = &$_FILES;
}
define("MAX_SIZE",0);
define("DESTINATION_FOLDER", "php_upload/avatar");
define("no_error", "sucess.php");
define("yes_error", "error.php");
$_accepted_extensions_ = "pdf,doc,docx,png,jpg";
if(strlen($_accepted_extensions_) > 0){
$_accepted_extensions_ = @explode(",",$_accepted_extensions_);
} else {
$_accepted_extensions_ = array();
}
/* modify */
if(!empty($HTTP_POST_FILES['dl_fichier'])){
if(is_uploaded_file($HTTP_POST_FILES['dl_fichier']['tmp_name']) && $HTTP_POST_FILES['dl_fichier']['error'] == 0){
$_file_ = $HTTP_POST_FILES['dl_fichier'];
$errStr = "";
$_name_ = $_file_['name'];
$_type_ = $_file_['type'];
$_tmp_name_ = $_file_['tmp_name'];
$_size_ = $_file_['size'];
if($_size_ > MAX_SIZE && MAX_SIZE > 0){
$errStr = "File troppo pesante";
}
$_ext_ = explode(".", $_name_);
$_ext_ = strtolower($_ext_[count($_ext_)-1]);
if(!in_array($_ext_, $_accepted_extensions_) && count($_accepted_extensions_) > 0){
$errStr = "Estensione non valida";
}
if(!is_dir(DESTINATION_FOLDER) && is_writeable(DESTINATION_FOLDER)){
$errStr = "Cartella di destinazione non valida";
}
if(empty($errStr)){
if(@move_uploaded_file($_tmp_name_,DESTINATION_FOLDER . "/" . $_name_)){
header("Location: " . no_error);
} else {
header("Location: " . yes_error);
}
} else {
header("Location: " . yes_error);
}
}
}
?>
<?php require_once('../Connections/obvrly.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "bulletin")) {
$insertSQL = sprintf("INSERT INTO download (dl_id, dl_titre, dl_fichier, dl_online) VALUES (%s, %s, '$_name_', %s)",
GetSQLValueString($_POST['dl_id'], "int"),
GetSQLValueString($_POST['dl_titre'], "text"),
GetSQLValueString($_POST['dl_online'], "int"));
mysql_select_db($database_obvrly, $obvrly);
$Result1 = mysql_query($insertSQL, $obvrly) or die(mysql_error());
$insertGoTo = "sucess.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
Et voilà le code HTML de mon formulaire:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<div id="download">
<form action="<?php echo $editFormAction; ?>" method="post" enctype="multipart/form-data" id="bulletin">
<table>
<tr valign="baseline">
<td align="right">Titre du bulletin</td>
<td><input type="text" name="dl_titre" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td align="right">Fichier </td>
<td><input type="file" name="dl_fichier" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td align="right"> </td>
<td><input type="submit" value="Insérer un enregistrement" /></td>
</tr>
</table>
<input type="hidden" name="dl_id" value="" />
<input type="hidden" name="dl_online" value="" />
<input type="hidden" name="MM_insert" value="bulletin" />
</form>
<p> </p>
</div>
Je sais pas si c'est comme cela qu'il fallait ajouter la ligne de code que tu m'as donné ? au pire j'ai pas d'erreur comme ca mais toujours le meme probleme!