Bonjour tous.
J'espère que vous aller bien ![;)](https://www.developpez.net/forums/images/smilies/icon_wink.gif)
J'ai un problème. Je veux utilisé uploadify pour télécharger des images
1 2 3 4 5 6 7 8 9 10 11
|
$('#image_fr').uploadify({
'uploader' : '../../manager/templates/rives/jquery/uploadify-v2.1.4/uploadify.swf',
'script' : '../../manager/templates/rives/jquery/uploadify-v2.1.4/uploadify.php?page='+page_id,
'cancelImg' : '../../manager/templates/rives/jquery/uploadify-v2.1.4/cancel.png',
'folder' : '../../images/produits/',
'fileExt' : '*.jpg; *.gif; *.png',
'fileDesc' : 'img',
'multi' : false
}); |
Si vous observez bien, je passe une variable "page_id" dans le fichier uploadify.
Si je mets une valeur fix ca marche.
Aussi, j'ai un formulaire avec un sélect. Quand je change déroule mon menu déroulant j'arive afficher la valeur de value="" comme ceci
1 2 3 4
|
$("#id_f_page").change(function() {
alert($(this).find("option:selected").text()+' clicked!');
}); |
J'aimerais que mon alert ait passer sa valeur de la variable qui est passer dans le fichier uploadify. Ceci de manière à ce que la valeur de ma variable page_id change a chaque fois que je sélectionne une nouvelle valeur de mon menu déroulant
Alors j'ai fait ceci
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
<script type="text/javascript">
$(document).ready(function() {
$("#id_f_page").change(function() {
var page_id = $(this).find("option:selected").val();
});
$('#image_fr').uploadify({
'uploader' : '../../manager/templates/rives/jquery/uploadify-v2.1.4/uploadify.swf',
'script' : '../../manager/templates/rives/jquery/uploadify-v2.1.4/uploadify.php?page_id='+page_id,
'cancelImg' : '../../manager/templates/rives/jquery/uploadify-v2.1.4/cancel.png',
'folder' : '../../images/produits/',
'fileExt' : '*.jpg; *.gif; *.png',
'fileDesc' : 'img',
'multi' : false
});
});
</script> |
Le problème, c'est que le page_id
uploadify.php?page_id='+page_id,
ne récupère par la valeur de ceci
var page_id = $(this).find("option:selected").val();
Pourriez-vous me dire ce que je peux faire?
Merci
Partager