file upload question
Posted: Mon Sep 05, 2005 3:32 pm
My knowledge of php is very limited, basically I only ever use it to pass stuff from mysql to flash. I am trying to upload images via flash into a folder as well as into a database. I can send a variable of the file to be uploaded from flash to php in the form "C:\example\the_file.jpg" but I don't know how to then upload it. Here is my <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> code with no error handling...
any help converting $users_file into something uploadable would be greatly appreciated. The database side of things works fine.
Code: Select all
<?php
$url_path = "gallery/"; //This variable will be passed from flash
$users_file = "D:\doc.txt"; //This variable will be passed from flash
$name = "test" //This variable will be passed from flash
$doc_directory = "/var/www/html/the_folder/";
$my_file = $url_path.$users_file;
$copy_path = $doc_directory.$my_file;
move_uploaded_file($users_file, $copy_path);
printf ($copy_path);
$db = mysql_connect("localhost", "root", "password");
mysql_select_db("the_db",$db);
$sql = "INSERT INTO the_table (file, name) VALUES ('$users_file', '$name')";
$result = mysql_query($sql);
?>