Hello
I'm french and I use a translator sorry in advance.
I use facebox for a file upload form, but I can not seem to display a confirmation or error messages in the facebox. When sending the form I have a new page that opens.
My send button to send a function:
<form method=\"post\" action=\"index.php?file=Forum&nuked_nude=index&op=up_img_confirm\" enctype=\"multipart/form-data\">
Here is all the code for the image send function and the 2nd function to display messages.
How to do ?
Thank you //Patch BBCode Upload Image
function up_img()
{
global $nuked, $theme, $language, $textarea, $image;
translate("lang/" . $language . ".lang.php");
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
. "<html xmlns=\"
http://www.w3.org/1999/xhtml\" xml:lang=\"fr\">\n"
. "<head><title>" . _BSCREEN . "</title>\n"
. "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n"
. "<meta http-equiv=\"content-style-type\" content=\"text/css\" />\n"
. "<link title=\"style\" type=\"text/css\" rel=\"stylesheet\" href=\"themes/" . $theme . "/style.css\" /></head>\n"
. "<script type=\"text/javascript\" src=\"js/bbcode.js\"></script>\n"
// facebox
. "<link href=\"facefiles/src/facebox.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />\n"
. "<script src=\"facefiles/lib/jquery.js\" type=\"text/javascript\"></script>\n"
. "<script src=\"facefiles/src/facebox.js\" type=\"text/javascript\"></script>\n"
. "<script type=\"text/javascript\">\n"
. "jQuery(document).ready(function($) {\n"
. " $('a[rel*=facebox]').facebox({\n"
. " loadingImage : 'facefiles/src/loading.gif',\n"
. " closeImage : 'facefiles/src/closelabel.png'\n"
. " })\n"
. " })\n"
. "</script>\n";
// fin
echo"<script type=\"text/javascript\">\n"
. "<!--\n"
. "\n"
. "function ajout_up_img(textarea){\n"
. "var up_image=document.getElementById('url_img').value;\n"
. "if (up_image != ''){ PopupinsertAtCaret(textarea, '[img]'+up_image+'[/img]'); }\n"
. "else{ alert('" . _NOURLIMG . " '); }\n"
. "}\n"
. "\n"
. "// -->\n"
. "</script>\n";
if ($image != "") {
$url_image = "upload/ImageForum/" . $image;
} else {
$url_image = "";
}
echo "<div><form method=\"post\" action=\"index.php?file=Forum&nuked_nude=index&op=up_img_confirm\" enctype=\"multipart/form-data\">\n"
. "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\">\n"
. "<div style=\"text-align: center;\"><tr><td>Saisissez une URL:</td></tr></div>\n"
. "<tr><td><b>" . _URLIMG . " : </b><input id=\"url_img\" type=\"text\" name=\"image\" value=\"" . $url_image . "\" size=\"39\" /> <input type=\"button\" name=\"ok\" value=\"OK\" onclick=\"ajout_up_img('" . $textarea . "');parent.close();\" /></td></tr>\n"
. "<div style=\"text-align: center;\"><tr><td>Ou cliquez sur Parcourir pour ajouter une image:</td></tr></div>\n"
. "<tr><td><b>" . _UPIMG . " : </b><input type=\"file\" name=\"fichiernom\" size=\"25\" /> <input type=\"submit\" name=\"Submit\" value=\"" . _SEND . "\" /></td></tr>\n"
. "<tr><input type=\"hidden\" name=\"textarea\" value=\"" . $textarea . "\" /></td></tr></table></form>\n";
}
//
displays confirmation message sending.
function up_img_confirm()
{
global $nuked, $theme, $bgcolor3, $language, $bgcolor2, $textarea, $image;
translate("lang/" . $language . ".lang.php");
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
. "<html xmlns=\"
http://www.w3.org/1999/xhtml\" xml:lang=\"fr\">\n"
. "<head><title>" . _BSCREEN . "</title>\n"
. "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n"
. "<meta http-equiv=\"content-style-type\" content=\"text/css\" />\n"
. "<link title=\"style\" type=\"text/css\" rel=\"stylesheet\" href=\"themes/" . $theme . "/style.css\" /></head>\n"
. "<script type=\"text/javascript\" src=\"js/bbcode.js\"></script>\n";
// Testons si l'extension est autorisée
$infosfichier = pathinfo($_FILES['fichiernom']['name']);
$extension_upload = $infosfichier['extension'];
$extensions_autorisees = array('jpg', 'jpeg', 'gif', 'png');
$name = $infosfichier['filename'];
$file = '' .time(). '.' .$extension_upload;
if (in_array($extension_upload, $extensions_autorisees)) {
move_uploaded_file($_FILES['fichiernom']['tmp_name'], 'upload/ImageForum/' . $file) or die ("<br /><br /><div style=\"text-align: center;\"><big><b>" . _UPLOADFAILED . "</b></big></div><br /><br />");
@chmod ($url_file, 0644);
echo "<div rel=\"facebox\" style=\"text-align: center;\"><tr><td><img src=\"images/icones/valider32px.png\" width=\"32\" height=\"32\"/></td><td><b>L'envoi de votre image bien été effectué !<br /></b></td></tr></div>";
redirect("index.php?file=Forum&nuked_nude=index&op=up_img&textarea=" . $textarea . "&image=" . $file, 3);
} else {
echo "<div style=\"text-align: center;\"><tr><td><img src=\"images/icones/erreur32px.png\" width=\"32\" height=\"32\"/></td><td><b><font color='red'>L'extension du fichier n'est pas autorisée. <br />(Seuls les fichiers jpg, jpeg, gif, png sont acceptés.)</font></b></td></tr></div>";
}
echo "<div style=\"text-align: center;\"><a href=\"#\" onclick=\"javascript:window.close()\"><b>" . _CLOSEWINDOW . "</b></a><br /></div></div></body></html>";
}
// End