So are you saying that you already have an upload script but dont know how to implement?
buddylee17
Practically a Master Poster
697 posts since Nov 2007
Reputation Points: 232
Solved Threads: 137
In dreamweaver, create a new php file. Clear all of the code out of the code view. Now click toggle plain text, copy and paste all of the following into dreamweaver:
<?php
if(isset($_POST['submit'])){
$numfilesuploaded = $_POST['numuploads'];
$count = 1;
while ($count <= $numfilesuploaded)
{
$conname = "new_file".$count;
$filetype = $_FILES[$conname]['type'];
$filename = $_FILES[$conname]['name'];
if ($filename != '')
{
if ($filetype == "application/msword" || $filetype=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")
{
$maxfilesize = $_POST['maxsize'];
$filesize = $_FILES[$conname]['size'];
if($filesize <= $maxfilesize )
{
$randomdigit = rand(0000,9999);
$newfilename = $randomdigit.$filename;
$source = $_FILES[$conname]['tmp_name'];
$target = "files/".$newfilename;
move_uploaded_file($source, $target);
echo $count." File uploaded | ";
}
else
{
echo $count." File is too big! 10MB limit! |";
}
}
else
{
echo " The file is not a supported type |";
echo $filetype;
}
}
$count = $count + 1;
}
}
?>
<?php
$numuploads = 1;
$count = 1;
?>
<form action="<?php echo $_server['php-self']; ?>" method="post" enctype="multipart/form-data" id="something" class="uniForm">
<?php
while ($count <= $numuploads)
{
?>
<input name="new_file<?php echo $count; ?>" id="new_file<?php echo $count; ?>" size="30" type="file" class="fileUpload" />
<?php
$count = $count + 1;
}
?>
<input type = "hidden" name="maxsize" value = "10240000">
<input type = "hidden" name="numuploads" value = "<?php echo $numuploads; ?>">
<button name="submit" type="submit" class="submitButton">Upload Files</button>
</form>
Name the above file uploader.php
Move the file to your server. In the same directory as the uploader.php file, create a new folder and name it files. Now go into your browser and test the uploader.php file.
buddylee17
Practically a Master Poster
697 posts since Nov 2007
Reputation Points: 232
Solved Threads: 137