View Full Version : file uploading

04-03-2008, 12:11 AM
Hey everyone...I new here...and new to Dreamweaver. I just took a class and have designed a couple simple sites.

My question is...I want to create a way to upload files(with a browse and upload button) from my site to my ftp. I am wanting to do this because I use Autocad files that are sometimes to large to email.

If anyone can point me in the right direction it would help out a lot. I'm using Dreamweaver CS3


04-03-2008, 04:36 AM
use an ftp pogram like fillezilla , free program have to google for it i forget the url

04-03-2008, 10:36 AM

Thanks for the info...I'll check it out.

04-04-2008, 03:18 PM
Yeah, once you download filezilla, just drag and drop the file into the folder you want to files to be, then it'll take some time to upload the files (depends the size of the file)

if you need more help please let me know

04-04-2008, 09:36 PM
I'm not very good at saying what i'm trying to do. I understand that I need a program like descibed above to up upload my files to generate my site, and I have done that. :D

What I don't know how to do is make (code) to have users on my site able to up load files to my server

With a Browse button (which takes you to your local files) and once you find the file you click a Upload button and it puts it on my ftp for me to take off later.

http://www.precision-design.net/contact.htm at the bottom of my page I have a upload link...which takes you to a different page. to where you can upload files. I got that code of the internet some where.

But I can't get it to work.

sorry for the...I am really new at this.


04-05-2008, 12:45 AM
without code no one can help you. however on your upload page you have
<form action="" method="post" enctype="multipart/form-data">which means you have not assigned the action of te form to anywhere

04-05-2008, 12:46 PM
Here is the code I got off the internet.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<title>Precision Design Upload</title>
/* Simple Upload manager
Script Version 0.4, copyright RRWH.com 2004
This script is distributed under the licence conditions on the website http://rrwh.com/scripts.php
This script is a simple interface to allow you to upload files to a configured directory on your server. It will additionally automatically create sub-directories if you want it to. Additionally, It will let you do a directory listing of the base directory or any specified sub-directory.
You only need to modify the $password and $dir variable and ensure that the directory exists on the server and the permission is set to 777
You may want to modify the $types if you wish to allow other file types to be uploaded - Be careful not to allow dangerous files to be uploaded to your server.
$pw = 'fred';
$dir = "./images/"; //Change this to the correct dir RELATIVE TO WHERE THIS SCRIPT IS, or /full/path/
//MIME types to allow, Gif, jpeg, zip ::Edit this to your liking
$types = array("application/pdf","image/png","image/x-png","audio/wav","image/gif","image/jpeg","image/pjpeg","application/x-zip-compressed","application/dwg");

// Nothing to edit below here.
//Function to do a directory listing
function scandir($dirstr) {
echo "<pre>\n";
passthru("ls -l -F $dirstr 2>&1 ");
echo "</pre>\n";
//Check to determine if the submit button has been pressed
if((isset($_POST['submit'])) and ($_POST['PW'] == $pw)){
//Shorten Variables
$tmp_name = $_FILES['upload']['tmp_name'];
$new_name = $_FILES['upload']['name'];
$path = $_POST['subdir'];
$fullpath = "$dir$path/";
$fullpath = str_replace("..", "", str_replace("\.", "", str_replace("//", "/", $fullpath)));
$clean_name = ereg_replace("[^a-z0-9._]", "", str_replace(" ", "_", str_replace("%20", "_", strtolower($new_name) ) ) );
// lets see if we are uploading a file or doing a dir listing
echo "Directory listing for $fullpath\n";

//Check MIME Type
if ((in_array($_FILES['upload']['type'], $types)) and (!file_exists($fullpath.$clean_name))){
// create a sub-directory if required
if (!is_dir($fullpath)){
mkdir("$fullpath", 0755);
//Move file from tmp dir to new location
move_uploaded_file($tmp_name,$fullpath . $clean_name);

echo "$clean_name of {$_FILES['upload']['size']} bytes was uploaded sucessfully to $fullpath";

//Print Error Message
echo "<small>File <strong><em>{$_FILES['upload']['name']}</em></strong> Was Not Uploaded - bad file type or file already exists</small><br />";
$name = $_FILES['upload']['name'];
$type = $_FILES['upload']['type'];
$size = $_FILES['upload']['size'];
$tmp = $_FILES['upload']['name'];

echo "Name: $name<br />Type: $type<br />Size: $size<br />Tmp: $tmp";

} else {
echo 'Ready to upload your file';
} ?>

<form action="<?php echo $_SERVER['ftp.precision-design.net']; ?>" method="post" enctype="multipart/form-data">

<legend>Upload Files</legend>
Password <input type="password" name="PW" /><br />
Do a directory Listing <input type="checkbox" name="Dir" value="on" /><br />
File to upload <input type="file" name="upload" /> <br />
Subdir to upload to/list directory: <input type="text" name="subdir" value="<?php $path = $_POST['subdir']; echo "$path";?>" /> (Can be blank) **Directory will be created if it does not exist<br />
<input type="submit" name="submit" value="Upload/List Files" />

04-05-2008, 12:53 PM
or look at my upload primer on this site

check out the tutorials