upload_js

Versions
4.7 – 7
upload_js()

Menu-callback for JavaScript-based uploads.

Code

modules/upload.module, line 774

<?php
function upload_js() {
  // We only do the upload.module part of the node validation process.
  $node = (object)$_POST['edit'];

  // Load existing node files.
  $node->files = upload_load($node);

  // Handle new uploads, and merge tmp files into node-files.
  _upload_prepare($node);
  _upload_validate($node);

  $form = _upload_form($node);
  foreach (module_implements('form_alter') as $module) {
    $function = $module .'_form_alter';
    $function('upload_js', $form);
  }
  $form = form_builder('upload_js', $form);
  $output = theme('status_messages') . form_render($form);
  // We send the updated file attachments form.
  print drupal_to_js(array('status' => TRUE, 'data' => $output));
  exit;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.