User login

File upload not working on Mac OS X development environment

Update: Solution

slarosa reported on this "Files Don't Attach" thread that the only thing that fixed file uploading was:

EXPLICITLY SET the upload tmp dir in php.ini to be THE SAME of the tmp dir set up in the file upload config in Drupal; for instance:

vi /Applications/xampp/etc/php.ini
Then in the file, make sure this is set and not commented out:
upload_tmp_dir = /tmp

That's how to do it.

For historical fun Agaric's misdirected debugging will stay down here.

Added drupal_set_message debug code

<?php
function file_save_upload($source, $validators = array(), $dest = FALSE, $replace = FILE_EXISTS_RENAME) {
  global $user;
  static $upload_cache;

  // Add in our check of the the file name length.
  $validators['file_validate_name_length'] = array();

  // Return cached objects without processing since the file will have
  // already been processed and the paths in _FILES will be invalid.
  if (isset($upload_cache[$source])) {
    return $upload_cache[$source];
  }
drupal_set_message('<pre>'.var_export($_FILES,TRUE).'</pre>');
//...
}
?>

Result:

array (
'files' =>
array (
'name' =>
array (
'upload_file' => 'sample-OBO_gene_ontology.obo',
),
'type' =>
array (
'upload_file' => '',
),
'tmp_name' =>
array (
'upload_file' => '',
),
'error' =>
array (
'upload_file' => 6,
),
'size' =>
array (
'upload_file' => 0,
),
),
)

Resolution

Searched words: 
File not uploading mac os x Xampp file uploads not working file upload silently fails XAMP on Mac OS X MAMP files fail to attach

Comments

thats it

I set temp directory to /Applications/xampp/tmp
Give permissions for that dir and the tranfer directory attach...

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.