MTGap Posted November 15, 2009 Share Posted November 15, 2009 I'm attempting to get a file upload script to work within PHP-Fusion. Unfortunately I can't actually get the file uploaded: } elseif ($_GET['stype'] == "d") { if (isset($_POST['submit_download'])) { if ($_POST['download_name'] != "" && $_POST['imagefile'] != "") { copy ($_FILES['imagefile']['tmp_name'], "/downloads/".$_FILES['imagefile']['download_name']); $download_cat = stripinput($_POST['download_category']); $download_title = stripinput($_POST['download_name']); $download_url = "/downloads/".$_FILES['imagefile']['download_name'].""; $result = dbquery("INSERT INTO ".DB_DOWNLOADS." (download_title, download_url, download_cat, download_datestamp, download_count) VALUES ('$download_title', '$download_url', '$download_cat', '".time()."', '0')"); add_to_title($locale['global_200'].$locale['700']); opentable($locale['700']); echo "<div style='text-align:center'><br />\n".$locale['705']."<br /><br />\n"; echo "<a href='submit.php?stype=d'>".$locale['706']."</a><br /><br />\n"; echo "<a href='index.php'>".$locale['412']."</a><br /><br />\n</div>\n"; closetable(); } } else { $opts = ""; add_to_title($locale['global_200'].$locale['700']); opentable($locale['700']); $result = dbquery("SELECT * FROM ".DB_DOWNLOAD_CATS." WHERE ".groupaccess("download_cat_access")." ORDER BY download_cat_name"); if (dbrows($result)) { while ($data = dbarray($result)) { $opts .= "<option value='".$data['download_cat_id']."'>".$data['download_cat_name']."</option>\n"; } echo $locale['420']."<br /><br />\n"; echo "<form name='submit_form' method='post' action='".FUSION_SELF."?stype=d' onsubmit='return validateLink(this);'>\n"; echo "<table cellpadding='0' cellspacing='0' class='center'>\n"; echo "<tr>\n<td class='tbl'>".$locale['701']."</td>\n"; echo "<td class='tbl'><select name='download_category' class='textbox'>\n$opts</select></td>\n"; echo "</tr>\n<tr>\n"; echo "<td class='tbl'>".$locale['702']."</td>\n"; echo "<td class='tbl'><input type='text' name='download_name' maxlength='100' class='textbox' style='width:300px;' /></td>\n"; echo "</tr>\n<tr>\n"; echo "<td class='tbl'>".$locale['704']."</td>\n"; echo "<td class='tbl'><input type='text' name='download_version' maxlength='100' class='textbox' style='width:300px;' /></td>\n"; echo "</tr>\n<tr>\n"; echo "<td class='tbl'>".$locale['703']."</td>\n"; echo "<td class='tbl'><input type='file' name='imagefile' class='textbox' style='width:300px;'></td>\n"; echo "</tr>\n<tr>\n"; echo "<td align='center' colspan='2' class='tbl'><br />\n"; echo "<input type='submit' name='submit_download' value='".$locale['700']."' class='button' />\n</td>\n"; echo "</tr>\n</table>\n</form>\n"; } else { echo "<div style='text-align:center'><br />\n".$locale['551']."<br /><br />\n</div>\n"; } closetable(); } } I get the following error after I submit the form: Notice: Undefined index: imagefile in /home/troop1/public_html/submit.php on line 139 Notice: Undefined index: imagefile in /home/troop1/public_html/submit.php on line 139 Warning: copy() [function.copy]: Filename cannot be empty in /home/troop1/public_html/submit.php on line 139 Notice: Undefined index: imagefile in /home/troop1/public_html/submit.php on line 142 Can anyone help me out with this? Link to comment https://forums.phpfreaks.com/topic/181628-php-fusion-upload-script/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.