rdkd1970 Posted November 1, 2011 Share Posted November 1, 2011 I am working on making an album however I am not sure where I am going wrong with my codes. I have an upload and thumbs folder in the albums folder but I keep getting this message.... Warning: mkdir() [function.mkdir]: File exists in /home/ebermy5/public_html/albums/album_func.php on line 44 Warning: mkdir() [function.mkdir]: File exists in /home/ebermy5/public_html/albums/album_func.php on line 45 Warning: Cannot modify header information - headers already sent by (output started at /home/ebermy5/public_html/albums/create_album.php:9) in /home/ebermy5/public_html/albums/create_album.php on line 29 Codes: for line 44 and 45 function create_album($album_name, $album_description){ $album_name = mysql_real_escape_string(htmlentities($album_name)); $album_description = mysql_real_escape_string(htmlentities($album_description)); mysql_query("INSERT INTO `albums` VALUES ('', '".$_SESSION['SESS_ID']."', UNIX_TIMESTAMP(), `$album_name`,`$album_description`)"); mkdir('uploads/'.mysql_insert_id(), 0744); mkdir('uploads/thumbs/'.mysql_insert_id(), 0744); } Code: for line 29 if(isset($_POST['album_name'], $_POST['album_description'])){ $album_name = $_POST['album_name']; $album_description = $_POST['album_description']; $errors = ""; if(empty($album_name) || empty($album_description)){ $errors = 'Album name and description required'; }else{ if(strlen($album_name) > 55 || strlen($album_description) > 255){ $errors = 'One or more fields contains too many characters'; } } if(!empty($errors)){ foreach($errors as $error){ echo $errors, '<br />'; } } else { create_album ($album_name, $album_description); header('Location: albums.php'); exit(); } } Link to comment https://forums.phpfreaks.com/topic/250247-uploading-a-file/ Share on other sites More sharing options...
Pikachu2000 Posted November 1, 2011 Share Posted November 1, 2011 Are you sure the insert query actually succeeds? You'd need to use mysql_affected_rows() for that. As for your header error, there is output beginning on or before line 9. Link to comment https://forums.phpfreaks.com/topic/250247-uploading-a-file/#findComment-1284052 Share on other sites More sharing options...
rdkd1970 Posted November 1, 2011 Author Share Posted November 1, 2011 I dont think it succeeds to upload so I am not sure if the file is in the correct order or what. I did not make the header on line 9 usable it is for the same albums.php but that is at the bottom also. Link to comment https://forums.phpfreaks.com/topic/250247-uploading-a-file/#findComment-1284053 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.