I have a content type with a field type image. When I create a new node of that content type and click the browse button and then upload the image and immediately I refresh the page, every field is empty (that is ok), but the file remains in the files folder even after I run cron.  I checked the database and the file is set in the table file_managed with the status 0. Is weird because after the cron the uploaded image should be removed.  Any clue? Thanks!
121352
I'm using Drupal 7.  On my site, users can add pictures via a content type, Pictures, that makes use of the core image field.  If a user uploads an image file and saves the node, then if the node is deleted the image file will be deleted as well.  However, if a user uploads an image file and then leaves the page, the image file remains stored in the filesystem and is not deleted.  This means that if users are careless, it is possible for them to add lots of pictures that will never be seen and never be deleted, wasting lots of disk space.  Is there any way to automatically delete these "orphan" files?
44848
I'm using Drupal 7 and created a content type 'NewArticle' with the fields 'Title', 'Text' and 'Image'. Users have the permission to create a 'NewArticle', but I don't like the way of displaying the administration bar in order to let them create a 'NewArticle'.  Instead, I'd like to work with . My goal is to create a Webform with exactly the same fields as the content type 'NewArticle'. So what I want is: when users filled in the form and submit it, a new node 'NewArticle' is created with the submitted information.  How can I do this? Are there modules that make this possible? I can't find any...
89626
I have seen .      You should consider using inotifywait, as an example:  inotifywait -m /path -e create -e moved_to |     while read path action file; do         echo "The file '$file' appeared in directory '$path' via '$action'"         # do something with the file     done    My question is that, the above script watches a directory for creation of files of any type, but how do I modify the inotifywait command to report only when a file of certain type/extension is created (or moved into the directory) - e.g. it should report when any .xml file is created.  WHAT I TRIED:  I have run the inotifywait --help command, and have read the command line options. It has --exclude &lt;pattern&gt; and --excludei &lt;pattern&gt; commands to EXCLUDE files of certain types (by using regEx), but I need a way to INCLUDE just the files of a certain type/extension.
56460
Currently i am unable to create images that get resized automaticaly according to the different image styles.  This includes the default styles such as thumbnail as well as the custom created styles.  I have checked the "Public file system path" as well as the "Temporary directory" (under Configuration > File system).  Both of the directories exist.  The file permissions are good on the directories (777).  The original file that's uploaded gets created. It's just the scaled images that aren't getting created.  Any help with this problem would be very welcome. If there is already a solution somewhere (which means i searched for the wrong terms), a link to that would be very appreciated.  edit:   I can't find anything in the logfile either, except for messages like :  type : page not found  message: sites/default/files/styles/thumbnail/public/fotoslider/slider_images/testbeeld20130103005.jpg
7478
I would like to upload a file asynchronously with jQuery.     $(document).ready(function () {     $("#uploadbutton").click(function () {         var filename = $("#file").val();          $.ajax({             type: "POST",             url: "addFile.do",             enctype: 'multipart/form-data',             data: {                 file: filename             },             success: function () {                 alert("Data Uploaded: ");             }         });     }); }); &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"&gt;&lt;/script&gt; &lt;span&gt;File&lt;/span&gt; &lt;input type="file" id="file" name="file" size="10"/&gt; &lt;input id="uploadbutton" type="button" value="Upload"/&gt;     Instead of the file being uploaded, I am only getting the filename. What can I do to fix this problem?
64273
Currently trying to update a field every time a node is created or updated. However the value is not being populated within the node, do I have access to the node object with this particular hook? What could I be missing?    function vbtoken_node_update($node) {         entity_get_controller('node')-&gt;resetCache(array($node-&gt;nid));         $types = node_type_get_types(); //What are the current Node Content Types?       $yes = ($types['volunteer_project']-&gt;type);        if($node-&gt;type === $yes){           $hash = md5($node-&gt;title . $node-&gt;nid . $node-&gt;nid);         $hashed = substr($hash, 0, 6);         $node = node_load($node-&gt;nid);         $node-&gt;tcode[$node-&gt;language][0]['value'] = $hashed;         node_save($node);          watchdog('vbtoken', 'Added a new Token code to %nid', array('%nid' =&gt; $node-&gt;nid));          }         else          {           dpm('not working dude');         }      }
3086
When I try to upload an image, I'm presented with the following dialog box,    The dialog box does not allow uploading either from my computer or by posting a link.  This happens only on Chrome browser (running on Windows). Clearing cache and cookies, and restarting computer do not resolve.  Is this just my computer? Or is this a site-wide bug?  Additional info:  Clicking on 'click' to upload does nothing. Dragging an image onto dialog redirects me to the file location on my computer. Clicking 'Add picture' redirects me to http://[SE-domain].com/upload/image?https=true.  UPDATE: A Norton extension for Chrome was the source of the problem.
3767
I created a module through Drupal Console, unfortunately it wasn't placed in a folder of its own, rather straight into /modules/custom. Before I noticed where it had gone, I enabled the module.   In Drupal 6/7, this was easy to fix - I could literally just put the files into the correct path, clear the cache (maybe rebuild the registry, it wasn't an exact science), and all was well.  The same isn't true for Drupal 8; I moved the files into a subfolder, rebuilt cache, and all requests tell me that Drupal is failing to include a required file. The particular file is a block class, and the path Drupal is trying to find it is where it used to be, not where I've moved it to.  The bit of code objecting is in Symfony's ApcClassLoader, so I guess I need to clear something that's slightly above Drupal's head to get this path reference updated.  How can I do that?  Uninstalling and re-installing the module does work, but once there's important data stored that's not going to be an option.  I was wrong, uninstalling and re-installing is not a viable option. After uninstalling and reinstalling, Drupal can no longer pick up the custom blocks the module defines. I'm guessing that reference is cached somewhere that isn't cleared when the module is uninstalled. Just need to find out where that is and how to clear it...
96983
I have extended class WP_List_Table to create a custom sortable table of posts along with a quick edit box with custom meta boxes.  The meta boxes populate and save but when I click submit the field values disappear and the defaults ( cb, title, tags, cats, etc) which are not even included in my class get added back to the column saved. This throws off the other columns on the page.  The saved custom field values return when the page is refreshed.  It seams like on submit the $post_object is missing.  I'm using a hacked get_inline_data function that includes the meta_values in my quick edit form instead of calling get_inline_data in my class.  My save function for the meta boxes:  add_action( 'save_post', 'save_inline_edit_meta' ); function save_inline_edit_meta( $post_id  ) {     global $pagenow;      if ( $pagenow == 'admin.php' ) {      if ( isset( $_POST[ 'is_quickedit' ] )  &amp;&amp; isset( $_POST[ 'standinghead' ] ) )         update_post_meta( $post_id, '_wnd_standing_head', $_POST[ 'standinghead' ] );      if ( isset( $_POST[ 'is_quickedit' ] )  &amp;&amp; isset( $_POST[ 'headline' ] ) )         update_post_meta( $post_id, '_wnd_alt_title', $_POST[ 'headline' ] );      if ( isset( $_POST[ 'is_quickedit' ] )  &amp;&amp; isset( $_POST[ 'deck' ] ) )         update_post_meta( $post_id, '_wnd_deck', $_POST[ 'deck' ] );     }   return $post_id;  }   My Javascript save function:  save : function(id) {         var params, fields, page = $('.post_status_page').val() || '';          if ( typeof(id) == 'object' )             id = this.getId(id);         $('table.widefat .inline-edit-save .waiting').show();         params = {             action: 'inline-save',             post_ID: id,             post_type: 'post',             edit_date: 'true',             post_status: page         };         fields = $('#edit-'+id+' :input').serialize();         params = fields + '&amp;' + $.param(params);          $.post('admin-ajax.php', params,             function(r) {                 $('table.widefat .inline-edit-save .waiting').hide();                  if (r) {                     if ( -1 != r.indexOf('&lt;tr') ) {                         $(inlineEditPost.what+id).remove();                         $('#edit-'+id).before(r).remove();                         $(inlineEditPost.what+id).hide().fadeIn();                     } else {                         r = r.replace( /&lt;.[^&lt;&gt;]*?&gt;/g, '' );                         $('#edit-'+id+' .inline-edit-save .error').html(r).show();                     }                 } else {                     $('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show();                 }             }         , 'html');         return false;     },
78656
I have a content type with 20 different fields.   Now the project requirement changed and I dont need 15 fields of them. So I removed all those unwanted 15fields from content type.   But the database is still holding all the 15 tables and also the revision table, Why? What happens if I remove it?  I feel like having these many unused tables in database might impact the performance. Will it really have impact on the performance?
112379
I have some use cases where I need to build a web form that includes a way for a site visitor to upload a file (jpeg, png, pdf types)  Any ideas on the best way to do this?
61965
My module provides a configuration form which allows to select a content type and on submit 2 new fields will be added to the selected content types.  I want to add these fields to the content types programmatically and I tried this using hook_entity_bundle_field_info but the fields don't get saved.  How can I save the fields? And how can I delete the fields (if the user changes the content type in the configuration form)?
69135
I generate some images using a PHP lib.  Sometimes the browser does not load the new generated file.   How can I disable cache just for images created dynamically by me?  Note: I have to use same name for the created images over time.
17815
I need to change a field in a node without altering the 'changed' timestamp. I know this was possible in Drupal 7 using field_attach_update(), but that has been removed since then.  I could use an update query and change the field directly in the database, but I was wondering if there is a better way (or a replacement for field_attach_update()).
96739
how to validate file upload in drupal means,  in my form allowed only txt file, but now user also can upload image file also after change the extention .jpg -> .txt  function oz_workbench_moderation_buttons_form_alter(&amp;$form, $form_state, $form_id) {   dpm($form);   if ($form_id == 'catalog_node_form'  )     {     $form['#validate'][] = 'upload_validate_function';           return $form;     } }  function upload_validate_function(&amp;$form, $form_state){ $extensions = array('txt' =&gt; 'text/plain; charset=us-ascii','doc' =&gt; 'application/msword; charset=binary','pdf' =&gt; 'application/pdf; charset=binary','xls' =&gt; 'application/octet-stream; charset=binary','docx' =&gt; 'application/vnd.openxmlformats-officedocument.wordprocessingml.document; charset=binary'); $uploadedfile=count($form_state['values']['field_application_document']['und']);         for($i=0;$i&lt;$uploadedfile-1;$i++){                 $file_name=$form_state['values']['field_application_document']['und'][$i]['fid'];                  $file_handler = file_load($file_name);                 $file = $file_handler-&gt;uri;                 $filename = $file_handler-&gt;filename;                 //echo $file;                 $finfo = new finfo(FILEINFO_MIME);                 $type = $finfo-&gt;file($file);                 //echo $type;                     if (!in_array($type, $extensions) )                     {                     drupal_set_message(t($filename.' is not valid file'), 'error');                     }          } }
110497
CentOS 6.x   I'm confused on when exactly files I place in /tmp/ are deleted.  /etc/cron.daily/tmpwatch has the following:  #! /bin/sh flags=-umc /usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \         -x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \         -X '/tmp/hsperfdata_*' 10d /tmp /usr/sbin/tmpwatch "$flags" 30d /var/tmp for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do     if [ -d "$d" ]; then         /usr/sbin/tmpwatch "$flags" -f 30d "$d"     fi done   The section in line 5 that reads -X '/tmp/hsperfdata_*' 10d /tmp leads me to believe that files I place in /tmp/ will remain for 10 days (assuming they aren't locked during deletion of course or the directory is mounted on a tmpfs file system).   Is that correct?
11353
How do you set an existing file path for a file field, in Drupal 7? The only option I see is to upload the file again.  In Drupal 6,  seems to do this.   Does  or  along with file field allow assignment of server files? Is there an API to programmatically manage file fields?  Edit I just discovered that this can all be done with the media module. I also have  installed. However it is not completely intuitive, so here are the steps I took:  Import to media library: /admin/content/media/import    Create a mediafile asset field. This allows you to attach from the library.    Display formats (example for audio) are at /admin/config/media/types/manage/audio/display/, instead of content type "manage display" which only provides "large", "small", "preview", etc.