Richard at 21ao
|
Posted: 04/27/2001, 2:10 PM |
|
Hi
Is there any way of uploading files with a button on the website, rather
than having to manually uploading via ftp?
Regards
Rich
|
|
|
Jeff Held
|
Posted: 04/27/2001, 2:34 PM |
|
I got it going...but I had to do some changes by hand.
Let's start a thread of how to do this.
Jeff Held
"Richard at 21ao" <richard@21ao.com> wrote in message
news:9ccn8h$cv0$1@mail.tankhill.com...
> Hi
>
> Is there any way of uploading files with a button on the website, rather
> than having to manually uploading via ftp?
>
> Regards
>
> Rich
>
>
|
|
|
Steven Dowd
|
Posted: 04/27/2001, 4:04 PM |
|
I found this while hunting an upload solution a few weeks ago, It proved
usefull to me.
Hope you find it usefull
Steven
<?php
/* Destination of Upload files..use / insted of \\ in UNIX */
define("DESTINATION", "c:\\upload\\"); /* "../upload/"*/
/* Number of Upload files */
define("UPLOAD_NO", 10);
echo("<p align='center'><b><font size='4'>MultiUPLOAD");
if($REQUEST_METHOD!="POST")
{
print "<form enctype=\"multipart/form-data\" method=post>\n";
print "<INPUT TYPE=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"3000000\">\n";
for($i=1; $i<=UPLOAD_NO; $i++)
{
echo "<input type=file name=infile$i> ";
if($i%2==0)
print"<br>";
}
echo "<br><br><input type=submit value=upload></form>\n";
}
else
{
/* handle uploads */
$noinput = true;
for($i=1; $noinput && ($i<=UPLOAD_NO); $i++)
{
if(${"infile".$i}!="none") $noinput=false;
}
if($noinput)
{
print "<big><B>Error uploading. Try again.</B></big>";
exit();
}
echo("<p align='center'><b><font size='4'>Successfully Uploaded<br>");
echo("<table border='1' width='84%' height='52' bordercolorlight='#008080'
bordercolordark='#008080'>
<tr>
<td width='14%' bgcolor='#008000' height='21'><font
color='#FFFFFF'><b>Sn</b></font></td>
<td width='52%' bgcolor='#008000' height='21'><font
color='#FFFFFF'><b>Filename</b></font></td>
<td width='34%' bgcolor='#008000' height='21'><font
color='#FFFFFF'><b>Size</b></font></td>
</tr>");
for($i=1; $i<=UPLOAD_NO; $i++)
{
$just=filesize(${"infile".$i});
$fp_size = $just;
if(${"infile".$i}!="none" &&
copy(${"infile".$i}, DESTINATION.${"infile".$i."_name"}) &&
unlink(${"infile".$i}))
{
echo("<tr>
<td width='14%' height='19'>$i</td>
<td width='52%' height='19'>${"infile".$i."_name"}</td>
<td width='34%' height='19'>$fp_size</td>
</tr>
");
}
}
echo "</table>";
}
?>
|
|
|
|