File Upload got me stumped !!!!
Posted: Thu Feb 17, 2005 2:47 pm
Any help on this would be great.
I am trying to upload files into directories based on a parameter passed through a URL. I have created a RS for this.
If i use the line commented out, it uplaods fine, but when i try to use the recordset bID as the folder name, it always uploads to the root.
feyd | Please post using formatting tags
I am trying to upload files into directories based on a parameter passed through a URL. I have created a RS for this.
If i use the line commented out, it uplaods fine, but when i try to use the recordset bID as the folder name, it always uploads to the root.
Code: Select all
//Created Recordset
mysql_select_db($database_band, $band);
$query_rsControl = sprintf("SELECT band.bID, band.bName, band.bType, band.bLevel, band.style, band.userID, users.sessionid FROM users INNER JOIN band ON users.userID = band.userID WHERE (((users.sessionid)='%s')) AND band.bID = '%s'", $colname_rsControl,$colname1_rsControl);
$rsControl = mysql_query($query_rsControl, $band) or die(mysql_error());
$row_rsControl = mysql_fetch_assoc($rsControl);
$totalRows_rsControl = mysql_num_rows($rsControl);
<?php
//This is the code
if (!empty($_FILESї'ourFile']ї'name'])) {
//This line will upload fine into the correct folder.
//$saveDirectory = 'bands/62/';
$saveDirectory = 'bands/'.$row_rsControlїbID].'/';
$tempName = $_FILESї'ourFile']ї'tmp_name'];
$fileName = $_FILESї'ourFile']ї'name'];
if (move_uploaded_file($tempName, $saveDirectory . $fileName)) {
echo 'File Successfully Uploaded!';
} else {
echo 'There was an error whilst uploading the file.';
}
} else {
?>feyd | Please post using formatting tags