jpratt Posted November 28, 2006 Share Posted November 28, 2006 This is my code:[code]if($HTTP_POST_FILES['File_Name']['size'] > 0 && !file_exists("../owner/files/".$HTTP_POST_FILES['File_Name']['name'])) { $FileIn = $HTTP_POST_FILES['File_Name']['tmp_name']; $FileOut = "../owner/files/".$HTTP_POST_FILES['File_Name']['name']; move_uploaded_file($FileIn, $FileOut);if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO faqfile (File_FAQ_ID, File_Name) VALUES (%s, %s)", GetSQLValueString($_POST['File_FAQ_ID'], "int"), GetSQLValueString($HTTP_POST_FILES['File_Name']['name'], "text")); mysql_select_db($database_database, $database); $Result1 = mysql_query($insertSQL, $database) or die(mysql_error());} $insertGoTo = "update.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo));}[/code]I keep getting an error that 'File_name' is an undefined index. I have played with file uploads before but not like this. Anyone have an idea? Quote Link to comment Share on other sites More sharing options...
zq29 Posted November 28, 2006 Share Posted November 28, 2006 I think we're going to need to see your input form, also, $HTTP_POST_FILES is depreciated as far as I know, use $_FILES instead. Quote Link to comment Share on other sites More sharing options...
jpratt Posted November 28, 2006 Author Share Posted November 28, 2006 Here is my form:[code]<form action="<?php echo $editFormAction; ?>" method="post" enctype="multipart/form-data" name="form1"> <?php if($HTTP_POST_FILES['File_Name']['size'] > 0 && file_exists("../owner/files/".$HTTP_POST_FILES['File_Name']['name'])) { ?><p class="CaptionText">File name already in use, change file name or delete file off server!</p> <?php } ?> <table align="center"> <tr valign="baseline"> <td nowrap align="right">File Name:</td> <td> <input name="File_Name" type="file" class="inputbox" id="File_Name"></td> </tr> <tr valign="baseline"> <td colspan="2" align="center" nowrap><input name="Button" type="button" class="btn" onClick="MM_goToURL('parent','update.php?ID=<?php echo $_GET['ID']; ?>');return document.MM_returnValue" value="Cancel"> <input type="submit" class="btn" value="Insert record"></td> </tr> </table> <input type="hidden" name="File_FAQ_ID" value="<? echo $_GET['ID']; ?>"> <input type="hidden" name="MM_insert" value="form1"> </form>[/code] Quote Link to comment Share on other sites More sharing options...
glenelkins Posted November 28, 2006 Share Posted November 28, 2006 set "error_reporting" to "E_ALL & ~E_NOTICE" (error_reporting=E_ALL & ~E_NOTICE) in php.ini. Voila! Quote Link to comment Share on other sites More sharing options...
jpratt Posted November 28, 2006 Author Share Posted November 28, 2006 is the tilde'~' sapose to be in there? I tried it and it did not fix the errors. Quote Link to comment Share on other sites More sharing options...
glenelkins Posted November 28, 2006 Share Posted November 28, 2006 Yup thats supposed to be in thereE_ALL[space]&[space]~E_NOTICEYou need to restart apache when you have saved php.ini Quote Link to comment Share on other sites More sharing options...
jpratt Posted November 29, 2006 Author Share Posted November 29, 2006 nope didnt work. I still get the error. Any ideas? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.