yeah i have one for you you use 2 diffrent files the first one is setup.php-----
setup.php
<?php
$ADMIN[RequirePass] = "No"; // Checks to see if upload has a vaild password
$ADMIN[Password] = "password"; // This is the password if the above option is Yes
$ADMIN[UploadNum] = "5"; // Number of upload feilds to put on the html page
$ADMIN[directory] = "uploads"; // The directory the files will be uploaded to (must be chmoded to 777)
?>
then there is uploader.php
--uploader.php--
<HEAD>
<TITLE>Uploader</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<?php
require("setup.php");
if($doupload) {
if($ADMIN[RequirePass] == "Yes") {
if($password != "$ADMIN[Password]") {
?>
<P><CENTER><B><FONT FACE="Verdana">Error</FONT></B></CENTER></P>
<P><CENTER><TABLE WIDTH="450" BORDER="0" CELLSPACING="0"
CELLPADDING="0">
<TR>
<TD WIDTH="100%" BGCOLOR="#000000">
<TABLE WIDTH="450" BORDER="0" CELLSPACING="1" CELLPADDING="2">
<TR>
<TD COLSPAN="2" BGCOLOR="#ffffff">
<FONT COLOR="#000000" SIZE="-1" FACE="Verdana">Invalid Password</FONT></TD>
</TR>
</TABLE></TD>
</TR>
</TABLE></CENTER></P>
<P><CENTER> </CENTER></P>
<P><CENTER> </CENTER></P>
</BODY>
<?php
exit();
}
}
$num = 0;
while($num < $ADMIN[UploadNum]) {
$num++;
$picture = "fileup$num"."_name";
$picture1 = $$picture;
$picture2 = "fileup$num";
$picture3 = $$picture2;
if($picture3 != "none") {
$filesizebtyes = filesize($picture3);
$ok = 1;
if($filesizebtyes < 10) {
$error .= "Error uploading (file size lower than 10 bytes) for file $num<BR>";
$ok = 2;
}
if(file_exists("$ADMIN[directory]/$picture1") OR $ok == 2) {
$error .="File name already exists for file $num<BR>";
} else {
copy ($picture3, "$ADMIN[directory]/$picture1");
$error .="File $num has been uploaded<BR>";
}
}
}
if(!$error) {
$error .= "No files have been selected for upload";
}
?>
<P><CENTER><B><FONT FACE="Verdana">Status</FONT></B></CENTER></P>
<P><CENTER><TABLE WIDTH="450" BORDER="0" CELLSPACING="0"
CELLPADDING="0">
<TR>
<TD WIDTH="100%" BGCOLOR="#000000">
<TABLE WIDTH="450" BORDER="0" CELLSPACING="1" CELLPADDING="2">
<TR>
<TD COLSPAN="2" BGCOLOR="#ffffff">
<FONT COLOR="#000000" SIZE="-1" FACE="Verdana"><?php echo $error; ?></FONT></TD>
</TR>
</TABLE></TD>
</TR>
</TABLE></CENTER></P>
<P><CENTER> </CENTER></P>
<P><CENTER> </CENTER></P>
</BODY>
<?php
exit();
} else {
$num = 0;
while($num < $ADMIN[UploadNum]) {
$num++;
$html .= "<TR>
<TD WIDTH=\"25%\" BGCOLOR=\"#295e85\">
<FONT COLOR=\"#ffffff\" SIZE=\"-1\" FACE=\"Verdana\">File $num:</FONT></TD>
<TD WIDTH=\"75%\" BGCOLOR=\"#ffffff\">
<INPUT NAME=\"fileup$num\" TYPE=\"file\" SIZE=\"25\">
</TD> ";
}
?>
<FORM ENCTYPE="multipart/form-data" ACTION="uploader.php" METHOD="POST">
<P><CENTER><B><FONT FACE="Verdana">Upload</FONT></B></CENTER></P>
<P><CENTER><TABLE WIDTH="450" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD WIDTH="100%" BGCOLOR="#000000">
<TABLE WIDTH="450" BORDER="0" CELLSPACING="1" CELLPADDING="2">
<TR>
<TD COLSPAN="2" BGCOLOR="#295e85">
<B><FONT COLOR="#ffffff" SIZE="-1" FACE="Verdana">Select Files</FONT></B></TD>
</TR><?php echo $html; ?>
</TABLE></TD>
</TR>
</TABLE></CENTER></P>
<?php
if($ADMIN[RequirePass] == "Yes") {
?>
<P><CENTER><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD WIDTH="100%" BGCOLOR="#000000">
<TABLE WIDTH="300" BORDER="0" CELLSPACING="1" CELLPADDING="2">
<TR>
<TD WIDTH="33%" BGCOLOR="#295e85">
<B><FONT COLOR="#ffffff" SIZE="-1" FACE="Verdana">Password:</FONT></B></TD>
<TD WIDTH="67%" BGCOLOR="#ffffff">
<INPUT NAME="password" TYPE="password" SIZE="25">
</TD>
</TR>
</TABLE></TD>
</TR>
</TABLE></CENTER></P>
<?php
}
?>
<P><CENTER><INPUT NAME="doupload" TYPE="submit" VALUE="Upload Files"></CENTER></FORM>
<P><CENTER> </CENTER></P>
<P><CENTER> </CENTER></P>
</BODY>
<?php
exit();
}
?>
there all that should work if not please get back to me here
Jaap wrote:
Hi,
I posted a question earlier asking what could be the trouble with:
if ($action == "upload")
{
if (isset($binFile) && $binFile != "none")
{
$data = addslashes(fread(fopen($binFile, "rb"), filesize($binFile)));
$strDescription = addslashes(nl2br($txtDescription));
$sql = "INSERT INTO tbl_Files ";
$sql .= "(description, bin_data, filename, filesize, filetype, owner, prop_num) ";
$sql .= "VALUES ('$strDescription', '$data', ";
$sql .= "'$binFile_name', '$binFile_size', '$binFile_type', '$current_user', '$propnum')";
if (!mysql_query ($sql, $link) )
{
die (mysql_error());
}
not working. Well, the way it looks it should be working, but my question now is: Can you replace this bit by a script that writes the data to a DIR instead of the DB? If so, who knows how to do it? I'm a bit of a newbie and been breaking my head over this. I could use some help since the problem won't solve itself (unfortunately).
All help would be greatly appreciated!
....