0

i am using an upload script, allowing the use of the "data" value to post additional information to the "upload.php" file. The description is as following :

data String, Function, Object ''

If given as string is used for sending additional parameters in GET to the php script. If given as function must return a url formated string. This function is excecuted on the start upload event, so the data are created when Upload button is pressed. If given as object must have this format {getvar:value, anothergetvar:value....}. This is similar to jQuery Ajax data.

I've got the following Code :

<script type="text/javascript">
$('#uploader_div').ajaxupload({
url:'upload.php',
language: 'de_DE',
data: "<?php echo $_GET['id']?>"
});
</script>

In my Source code, the value is parsed correctly and spits out "55" which is right cause i am on customer-ID 55 profile page. Now i want to get the data value in the "upload.php" i used :

$data = $_GET['data'] print_r($data)

and it doesnt return anything.

What can i do to get the value correct?

4

1 に答える 1

0

$.ajaxupload は $.ajax と同様に機能すると思いますが、これはデータを間違った方法で送信することを意味します。次のように行う必要があります。

data: {
    id: 13
}

そして、PHP スクリプトで次のようにデータを取得できます。

$id = $_GET['id'];

または、POST を使用する場合は、POST を使用します。

于 2012-10-10T12:48:32.983 に答える