emediastudios Posted January 10, 2009 Share Posted January 10, 2009 My code is pulled out of another form and im trying to get it to upload a pdf There are some errors with the " " in the $content .= part. <?PHP if(isset($_GET['action'])) { $action=addslashes($_GET['action']); } $content .= '<form enctype=\"multipart/form-data\" action=\"?action=douploadn\" method=\"POST\"> Upload Newsletter<br> <p> <label>File:</label><input type=\"file\" name=\"newsletter\" size=\"15\"> </p> <p> <label></label><input type=\"Submit\" value=\"Upload\"> </form>'; if ($action == "douploadn") { $filetype = $_FILES['newsletter']['type']; if($filetype == "application/pdf") { $target_path = "newsletter/"; $target_path = $target_path . basename( $_FILES['newsletter']['name']); if(move_uploaded_file($_FILES['newsletter']['tmp_name'], $target_path)) { $ok = "The file has been uploaded!"; } else { $ok = "There was an error when uploading the file!"; } $fn=basename( $_FILES['newsletter']['name']); echo "<center>$ok<br>You can see the file here: <a href=\"newsletter/".basename( $_FILES['newsletter']['name'])."\">".basename( $_FILES['newsletter']['name'])."</a>"; mysql_query("UPDATE newsletter SET newsname='$fn' WHERE newsid='1'"); } else { Header("Location: index.php?action=wrongtype"); } } ?> any help be great Link to comment https://forums.phpfreaks.com/topic/140240-solved-few-little-errors/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.