Welcome, Guest

Big problem with upload element and text area....
(1 viewing) (1) Guest

TOPIC: Big problem with upload element and text area....

Big problem with upload element and text area.... 3 years, 10 months ago #1328

Hello, I can't manage to get back the name of a file import with an upload element in my form (name: upl_itineraire_kml).

//+trace dis
//**Déclaration des variables globales utilisées dans ce formulaire
global $Itemid, $my;

//**Chargement de la librairie standard de gestion des pièces
$this->execPieceByName('ff_InitLib');

//**Décupération des données soummises
$date = date( "Y-m-d H:i" );
$titre = ff_getSubmit('txt_titre');
$distance = ff_getSubmit('txt_distance');
$montee = ff_getSubmit('txt_montee', 'N.C');
$descente = ff_getSubmit('txt_descente', 'N.C');
$altitude_maxi = ff_getSubmit('txt_altitude_maxi', 'N.C');
$duree_moyenne = ff_getSubmit('txt_duree_moyenne');
$boucle = ff_getSubmit('lst_boucle');
$difficulte_physique = ff_getSubmit('lst_difficulte_physique');
$difficulte_technique = ff_getSubmit('lst_difficulte_technique');
$description = ff_getSubmit('txt_description');
$remarques_sur_la_difficulte = ff_getSubmit('txt_remarques_difficulte', '<i>Il n&rsquo;y a aucune remarque sur la difficulté.</i>');
$commentaires_sortie = ff_getSubmit('txt_commentaires_sortie', '<i>Il n&rsquo;y a aucun commentaire de la part de l&rsquo;auteur.</i>');
$commune_de_depart = ff_getSubmit('lst_commune_de_depart');
$itineraire_kml = ff_getSubmit('upl_itineraire_kml');
$name = $my->name; // obtention du nom de la personne qui a soumis le formulaire

//**Definir l'état de l'article pour publication 0=non-publié 1=publié
$state = 0;

//**Définir la section et la catégorie où publier l'article
$category = $commune_de_depart;
$section = 4;

//**Préparation du rapport pour la création de l'article
$texte =
'<html>

<!--Propriétées itinéraire-->
<p class=style3><b>Propriétées</b></p>
<p>&nbsp;</p>
Distance: '.$distance.'<br>
Mont&eacute;e: '.$montee.'<br>
Descente: ' .$descente.'<br>
Altitude maxi: '.$altitude_maxi.'<br>
Dur&eacute;e moyenne: '.$duree_moyenne.'<br>
Fichier_upload: '.$itineraire_kml.'<br>
<p>&nbsp;</p>

<!--Fichier de téléchargement-->
<p class=style3><b>Téléchargement</b></p>
<p>&nbsp;</p>
<img src="infogeo.unige.ch/vtt/components/com_faci...e/kml_icon.png" border="0" align="middle" /><a href="infogeo.unige.ch/vtt/components/com_faci...s/4477.kml"> Trace au format KML</a>
<p>&nbsp;</p>
<img src="infogeo.unige.ch/vtt/components/com_faci...e/gpx_icon.png" border="0" align="middle" /><a href="infogeo.unige.ch/vtt/components/com_faci...k-2231.gpx"> Trace au format GPX</a>
<p>&nbsp;</p>


<!--Affichage de la carte-->
<p class=style3><b>Carte</b></p>
<p>&nbsp;</p>
<div id="map" style="width: 638px; height: 400px"></div>
<p>&nbsp;</p>

<!--Affichage de la description générale-->
<p class=style3><b>Description générale</b></p>
<p>&nbsp;</p>
'.$description.'
<p>&nbsp;</p>

<!--Affichage des remarques sur la difficulté-->
<p class=style3><b>Remarques sur la difficulté</b></p>
<p>&nbsp;</p>
'.$remarques_sur_la_difficulte.'
<p>&nbsp;</p>

<!--Affichage des commentaires de l&rsquo;auteur sur la sortie-->
<p class=style3><b>Commentaires de l&rsquo;auteur</b></p>
<p>&nbsp;</p>
'.$commentaires_sortie.'

</body>
</html>';


//**Obtention du userid du superadministrateur pour la création de l'article
//mais va utiliser dans l'alias le nom de la personne qui a soumis le formulaire
$creator = ff_select("select id, email, sendEmail from #__users where gid=25");
$creator = $creator[0]; // take first row

//**Sauvegarde la nouvelle sousmission dans la table #__content table
ff_query(
"insert into #__content ".
"(title, title_alias, introtext, state, sectionid, ".
"catid, created, created_by, created_by_alias) ".
"values ".
"('$titre', '$titre', '$texte', '$state', '$section', ".
"'$category', '$date', '$creator->id', '$name')"
);




The second bug, is about textfield content. When I whrite a single text without quote, everything is doing well, but if I put something like : L'artiste est plutôt interéssant. then I've an error message :

DB function failed with error number 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'artiste est plutôt intéressant.


<!--Af SQL=insert into jos_content (title, title_alias, introtext, state, sectionid, catid, created, created_by, created_by_alias) values ('Test', 'Test', '


Just a precision,I need to whrite in FRENCH in my textfield.

I've you get any idea?
  • nitro_1721
  • OFFLINE
  • Fresh Boarder
  • Posts: 11
  • Karma: 0

Re:Big problem with upload element and text area.... 3 years, 10 months ago #1329

$my doesnt exist anymore in Joomla 1.5, use
JFactory::getUser()->get('USERFIELD')

instead
  • admin
Last Edit: 3 years, 10 months ago by .

Re:Big problem with upload element and text area.... 3 years, 10 months ago #1331

Ok, but it works well with $my, and I try you solution and It didn't resolve my problems.

An other idea?
  • nitro_1721
  • OFFLINE
  • Fresh Boarder
  • Posts: 11
  • Karma: 0

Re:Big problem with upload element and text area.... 3 years, 10 months ago #1332

ok, for the first problem, what if you try to determine the filename by using
JRequest::getVar('xxx')


it is like using $_FILE


for the second: you need to quote your database entries.
  • admin
Last Edit: 3 years, 10 months ago by .

Re:Big problem with upload element and text area.... 3 years, 10 months ago #1333

Sorry but I'm a newbie ! How to put your code in my FORMS_SUBMPIECES code? And my database entries seems quote, isn't them?

ff_query(
"insert into #__content ".
"(title, title_alias, introtext, state, sectionid, ".
"catid, created, created_by, created_by_alias) ".
"values ".
"('$titre', '$titre', '$texte', '$state', '$section', ".
"'$category', '$date', '$creator->id', '$name')");
  • nitro_1721
  • OFFLINE
  • Fresh Boarder
  • Posts: 11
  • Karma: 0

Re:Big problem with upload element and text area.... 3 years, 10 months ago #1334

no, quotes are forced to be turned off, when you use ff_query you have to quote them "by hand".

Like this

JFactory::getDBO()->Quote($titre)
  • admin
Moderators: TheMuffinMan, ForumSupport
Time to create page: 0.38 seconds

Facebook Discount - 40% Off!

Fans of our Facebook page here are entitled to get a 1-year-subscription for the price of a 6-months!

Steps to take:

  • Become a fan on Facebook (Like) here
  • Purchase a 6-months-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of your like and we'll upgrade to the 1-year-subscription

Joomla!® Forms Discount - 40% Off!

Already purchased a forms extension from a different vendor but your requirements changed and now you need a forms extension that is capable of more than just the standards? We help you to keep the costs for a change under control: Get a 40% discount on our professional membership plan! -- meaning timely unlimited access to all current and future commercial extensions, breezingforms themes & apps and Joomla!® templates at crosstec.de, including 1 year of support -- without any website limitations -- Just prove that you previously purchased another forms extension for Joomla!® from a different vendor and you are qualified.

Steps to take:

  • Purchase a 1-year-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of the purchase for the other form vendor and we'll upgrade to the professional-subscription

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany

Imprint