cdog1912 Posted May 10, 2009 Share Posted May 10, 2009 Any help would be great Thanks. ------------------------------------------------------------------------------------------- Here the code: <form method="post" enctype="multipart/form-data"> <table width="350" border="0" cellpadding="1" cellspacing="1" class="box"> <tr> <td> <input type="hidden" name="MAX_FILE_SIZE" value="2000000"> Upload File:<input name="userfile" type="file" id="userfile"> </td> </tr> <tr> <td>Model Name:<input name="model" type="text" id="model"></td> </tr> <tr> <td>Album Name:<input name="album" type="text" id="album"></td> </tr> <tr> <tr> <td><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td> </tr> </table> </form> <?php $uploadDir = 'Images/'; if(isset($_POST['upload'])) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $model = $_POST['model']; $album = $_POST['album']; $folder = $_POST['f_dirs']; $filePath = $uploadDir . $fileName; $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error uploading file"; exit; } include 'config.php'; include 'opendb.php'; if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath = addslashes($filePath); } $query = "INSERT INTO upload2 (name, size, type, path, model, album ) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$filePath', '$model', '$album')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); $model_name = "INSERT INTO model_info (model_name)". "VALUES ('$model')"; mysql_query($model_name) or die('Error, model_name query failed : ' . mysql_error()); $album_name = "INSERT INTO album_info (album_name, model_name)". "VALUES ('$album', '$model')"; mysql_query($album_name) or die('Error, album_name query failed : ' . mysql_error()); include 'closedb.php'; echo "<br>Files uploaded<br>"; } ?> ---------------------------------------------------------------------------------------------- thanks Link to comment https://forums.phpfreaks.com/topic/157629-solved-how-do-i-select-upload-directory/ Share on other sites More sharing options...
Ken2k7 Posted May 10, 2009 Share Posted May 10, 2009 Use tags. I don't get what you mean by select upload directory. You already selected it via $uploadDir, right? Link to comment https://forums.phpfreaks.com/topic/157629-solved-how-do-i-select-upload-directory/#findComment-831218 Share on other sites More sharing options...
cdog1912 Posted May 11, 2009 Author Share Posted May 11, 2009 what i meant is to be able to select an upload directory from a drop down list in the form. Link to comment https://forums.phpfreaks.com/topic/157629-solved-how-do-i-select-upload-directory/#findComment-831310 Share on other sites More sharing options...
Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 Create the drop down list of directories in the form. :-\ You sort of just answered your own question. Link to comment https://forums.phpfreaks.com/topic/157629-solved-how-do-i-select-upload-directory/#findComment-831327 Share on other sites More sharing options...
neogemima Posted May 11, 2009 Share Posted May 11, 2009 Ken2K7 is right. Just create the drop down menu and assign it to the variable $uploadDir. Make sure you have those correct file locations and you should be good to go. Link to comment https://forums.phpfreaks.com/topic/157629-solved-how-do-i-select-upload-directory/#findComment-831411 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.