PRodgers4284 Posted March 6, 2008 Share Posted March 6, 2008 I have difficulty getting an upload file to work with an edit record form, I have the script working for an add record form and it sends the file to the database and the file directory folder fine, it just wont work when i try to edit the file, i think the update statement must be wrong but im not sure where exactly, can anyone see the problem or provide some advice on this? My script for the edit file upload is: $uploadDir = 'upload/'; if (isset($_POST['submit']) && $error_stat == 0) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; // the files will be saved in filePath $filePath = $uploadDir . $fileName; // move the files to the specified directory // if the upload directory is not writable or // something else went wrong $result will be false $result = move_uploaded_file($tmpName, $filePath); include("database.php"); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath = addslashes($filePath); } mysql_query("UPDATE users SET username='" . $_POST["username"] . "',jobcatergory='" . $_POST["jobcatergory"] . "',recentjob='" . $_POST["recentjob"] . "',employmenttype='" . $_POST["employmenttype"] . "', careerlevel='" . $_POST["careerlevel"] . "',educationallevel='" . $_POST["educationallevel"] . "',skills='" . $_POST["skills"] . "', name='$fileName', type='$fileType', size='$fileSize', path='$filePath' WHERE username='" . $_SESSION["username"] . "'"); ?> Link to comment https://forums.phpfreaks.com/topic/94709-upload-file-not-working-properly/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.