am modificat putin scriptul de upload de pe site, am incercat sa-l fac cu baza de date cand uplodez un fisier sa apara si in baza de date...
problema e ca se uploadeaza numai fisierul, am incercat mutle posibilitati dar nu a mers...
index.php:
Cod: Selectaţi tot
<title>...</title>
<link href="$#####" rel="stylesheet" type="text/css">
<center>
<h1>ShaRe - Free File Hosting</h1>
<hr width=350px color=gray>
<div style="width:333px; text-align:center;">
<form action="index.php?share=file" method="POST" enctype="multipart/form-data">
Upload Fisier:
<input type="file" name="fisiere" /> <br />
Categorie: <select name="categ">
<option value="man">1</option>
<option value="r">2</option>
<option value="sr">3</option>
<option value="img">Imagini</option>
</select><br/>
<input type="submit" name='submit' value="Upload" />
</form>
</div>
<div id="share-Footer">
Copyright © <b>#####</b>
</div>
</center>
<?php
include('config.php');
if($_GET['share']=="file"){
//$empty = $_POST['fisiere'];
$box=$_FILES['fisiere']['tmp_name'];
if (empty($box))
{
echo "<p align=\"center\">";
echo "<font size=\"6\"><font color=\"blue\"><b>Nici un fisier selectat!</b></font></font><br />";
echo "</p>";
exit();
}
$id=$_GET['id'];
$dw = $row['download'];
$browser = $_SERVER[HTTP_USER_AGENT];
$ip = $_SERVER['REMOTE_ADDR'];
$categ = $_POST['categ'];
$file = $_FILES['fisiere']['name'];
$size = $_FILES['fisiere']['size'];
$uploadpath = "u/";
$max_size = 20000;
$allowtype = array('bmp', 'flv', 'gif', 'jpg', 'jpeg', 'mp3', 'pdf', 'png', 'rar', 'zip');
if(isset($_POST['submit'])) {
if (isset ($_FILES['fisiere'])) {
$uploadpath = $uploadpath. $categ.'/'.'[####] ' . basename($_FILES['fisiere']['name']);
$type = end(explode(".", strtolower($_FILES['fisiere']['name'])));
if (in_array($type, $allowtype)) {
if ($_FILES['fisiere']['size']<=$max_size*1000) {
if (!file_exists($uploadpath)) {
if(move_uploaded_file($_FILES['fisiere']['tmp_name'], $uploadpath)) {
echo "Fisierul:<b><font color=\"red\"> ". basename( $_FILES['fisiere']['name']). "</font></b> a fost incarcat cu succes:";
}
$shareu = "INSERT INTO upload SET id='".$id."',file='".$file."',ip='".$ip."',size='".$size."',browser='".$browser."',download'".$dw."',categorie='".$categ."'";
mysql_query($shareu) or die("NU se poate adauga!");
echo "<br />Tipul fisieului:<b><font color=\"green\"> ". $_FILES['fisiere']['type'] ."</font></b>";
echo "<br />Marime (<i>in Bytes</i>): <b><font color=\"orange\">". $_FILES['fisiere']['size'] ."</font></b><br/><br/>";
echo 'Link de download: <b>http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['REQUEST_URI']).'/'.$uploadpath.'</b>';
}
else
{
echo "<b>Fisierul exista deja, <br />sau este posibil ca marimea fisierului sa depaseasca permisiunile setate de server.</b>";
}
}
else
{
echo 'Fisierul <b>'. $_FILES['fisiere']['name']. '</b> depaseste marimea permisa de maxim <i><b>'. $max_size. 'KB</b></i>';
}
}
else { echo 'Fisierul <b>'. $_FILES['fisiere']['name']. '</b> nu are tipul de extensie permis'; }
}
}
}
?>
Cod: Selectaţi tot
<?php
$server="localhost";
$db="db1###551-main";
$user="user16###51";
$pass="st####4$%er";
?>
Cod: Selectaţi tot
DirectoryIndex index.php
ErrorDocument 404 /eroare.php
php_flag register_globals on
RewriteEngine on
Cod: Selectaţi tot
--
-- Table structure for table `upload`
CREATE TABLE IF NOT EXISTS `upload` (
`id` int(100) NOT NULL auto_increment,
`file` varchar(250) NOT NULL default '',
`ip` int(100) NOT NULL default '0',
`size` int(100) NOT NULL default '0',
`browser` varchar(255) NOT NULL default '',
`download` int(100) NOT NULL default '0',
`categorie` varchar(225) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=338 ;
-- Dumping data for table `upload`
--
si daca e gresit cv in index.php..
P.S: am inlocuit adresa siteului si alte chestii cu ###
Multumesc:D