When you use + like you are there, it's trying to add your string to something.. which isn't a number, hence NaN. Could you not do ppost : { 'Path' : $FilePath, 'File' : $FileName } ? That would be my suggestion.
-- T.J. On Dec 22, 1:58 pm, Adrian Maleska <i...@augenpulver-design.de> wrote: > I've got a little problem with passing two strings $FilePath and > $FileName to the PHP file and I've got no clue why. When I do it this > way everything's Ok > > ppost : { > 'Path' : 'temp/', > 'File' : 'Myfile.jpg' > }, > > Of cause I need to do this via variable but when I do it in this way: > > $FilePath ="temp/"; > $FileName ="Myfile.jpg"; > > ppost : { > 'Path' : [+$FilePath], > 'File' : [+$FileName] > }, > > Everything that my PHP code recives is NaN for both variables. Could > you tell me why and what would be the proper way? > > The entire script: > > function ajaxFileUpload() > { > $("#loading") > .ajaxStart(function(){ > $(this).show(); > }) > .ajaxComplete(function(){ > $(this).hide(); > }); > $FilePath ="temp/"; > $FileName ="Myfile.jpg"; > > $.ajaxFileUpload > ( > { > url:'doajaxfileupload.php', > secureuri:false, > fileElementId:'fileToUpload', > ppost : { > 'Path' : [+$FilePath], > 'File' : [+$FileName] > }, > dataType: 'json', > success: function (data, status) > { > > }, > error: function (data, status, e) > { > alert(e); > } > } > ) > > return false; > > }