Re: File uploading?

From: Date: Wed, 31 Jan 2001 17:44:48 +0000
Subject: Re: File uploading?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-37511@lists.php.net to get a copy of this message
Here is the code i'm running for my file upload and it work correctly: // file with submit form <form name="postfile" method="post" action="./postfile.php" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="10000000"> <input type="file" name="name of var" size="x"> <input type="submit" name="submit" value="submit"> </form> // This is the file that you want to use as post // example is postfile.php <?php copy($name of var_name, "/full/path/$name of var"); ?> // That will copy the file. here is the full function I have implemented with my page to store path into mysql. function upload_prog($file,$filename,$des,$name,$size,$dateadded,$addedby,$type) { copy($file, "c:/full/path/to/dir/$filename"); $result = mysql_query("INSERT INTO tablename(prog_name,prog_size,prog_des,prog_url,prog_date_added,added_by,prog_type) VALUES ('$name','$size','$des','./filez/$filename','$dateadded','$addedby','$type')"); $id = mysql_insert_id(); $result = mysql_query("SELECT * FROM tablename WHERE id='$id'"); $myrow = mysql_fetch_array($result); } // this will store the path into the MySQL and you can use it as a link. Hope this helps you. James __________________________________________________ Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/

« previous php.general (#37511) next »