开发者

retrieving variable from PHP processing script?

I'm using a PHP file upload processing script (uploadify.com) in order to allow users to upload images along with their form submission. The processing script includes a step that gives that file a unique file name. What I would like to do is retrieve that unique file name in order to include with my form submission to the database.

The uploading script is run externally and never reloads the form page. Not sure if I can use session variables or POST/GET. Does this make sense?开发者_运维技巧


The uploadify sends ajax request to the php script that you specify to it via script settings.

Let's say you have file input field like this:

<input id="file_upload" name="file_upload" type="file" />

You can get that in your php script via $_FILES array like this:

var_dump($_FILES('file_upload'));

See the uploadify's documentation for more information.

You can also check the source of php file that comes with uploadify package when you download it.


It sounds like you are running this PHP upload script AJAX style. In that case I would suggest doing something like:

var filename = $.ajax({
    async: false,
    type: "POST",
    url: "url-to-php-script.php",
    data: "postVar=value"
    }).responseText;

In your php script you need to just echo out the filename and it will be placed in the variable filename.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜