All Questions
67 questions
24
votes
5
answers
19k
views
How to set value of file field with entity_metadata_wrapper
How do you set the value of a file field when using the entity_metadata_wrapper?
I've tried doing this in code:
$file = new stdClass();
$file->uid = 1;
$file->uri = $file_path;
$file->...
8
votes
2
answers
6k
views
Example of hook_file_download
How do I restrict the access to certain files based on their content type? I have the download section for registered users, and I want to prevent them to post links somewhere outside my site.
Is ...
5
votes
1
answer
2k
views
In Drupal 7, how do I create a custom rules event for any and all file entities?
I'm having trouble creating a small module to add an Event scenario to Rules using the Rules API. Basically, I'm creating a rule that should detect to see if certain fields of a file entity have ...
5
votes
2
answers
2k
views
Displaying the contents of a document file (doc, docx, etc.)
I'm looking for a way to display the contents of an uploaded document file such as a .docx file.
In Drupal 6 I used the iPaper module which did the trick as all I needed was api code to connect ...
4
votes
2
answers
4k
views
Template suggestions for file_entity.tpl.php
Short version
My aim is to theme a file field in a view of node fields. In the view configuration, the field formatter is set to Rendered file and a view mode is selected. How do I suggest a template ...
4
votes
3
answers
4k
views
Migrating multiple values into a single file field in Drupal 7 with Migrate 2.2
I have a file field that can have multiple downloadable files for an image node type. These images will have several versions (psd, jpg, eps) that will be downloadable. I would like to be able to ...
4
votes
1
answer
1k
views
attach file to a node by code
I wanted to associate a file to a node. so far so good. create a cck type file, and the problem was solved. but I can not do this, I do not want the user to choose the file. the file in question is ...
4
votes
1
answer
741
views
How to alter the Views field Format drop-down menu
I am exporting some XML feeds using Views. One of these fields needs to look like this:
<image>http://example.com/path/to/myimage.jpg</image>
I am storing my image in a CCK field. When ...
4
votes
1
answer
2k
views
File upload field in CCK field settings
Is there a difference in Drupal 7 to add a file-upload field on a "normal" form (i.e. a separate page for a modules' configuration) as opposed to the small settings area for a CCK field (the one that ...
4
votes
2
answers
445
views
Image upload & gallery
Is there a way to limit the number of imagefield fields present in a node?
I am using iTweak Upload, which allows to upload an unlimited number of images, but I need something that can limit the ...
4
votes
2
answers
1k
views
Upload file and fill in fields in one step; or trigger a rule when a file is uploaded
I want to make use of the Media module and the File entity module to upload files, in particular images, to my site without having to attach them to a node. Solely uploading images works like a charm, ...
3
votes
1
answer
4k
views
image field - how to overwrite existing image?
How to set up the image field in a content type so that it always overwrites images with the same name instead of creating new images with name suffix _0, _1 etc. Currently, while editing a node and ...
3
votes
1
answer
75
views
How to store field data in a file instead of the db?
So far, I found two decent options for storing field in a file:
using node hooks to store data in a filefield, and process it on node view
theoretically, the best would be to use file storage as a ...
3
votes
2
answers
2k
views
Storing images as nodes
I am building a Drupal 7 platform where users can share images. In a nutshell, people should be able to comment on images and like them.
The way I realized this is by creating a custom content type ...
3
votes
1
answer
336
views
Theming views and overwriting the default file upload display
Theming views in Drupal 7 can be very tedious to newbies. In the following example, a seemingly simple task has become an overwhelming research project into the innards of Drupal! Hoping an ...
3
votes
2
answers
1k
views
Image and other media file management
My question may seem vague but I'm confused and need advice on Drupal 7 media files management, so please bear with me. I'm looking for existing modules or ways to build the following functionality ...
3
votes
4
answers
235
views
Single document, multiple filetypes for download: how to manage?
I want to upload/attach several documents to a book node. Each document will be offered in a number of file formats, for example:
Report2010.pdf
Report2010.rtf
Report2010.doc
Agreement11.pdf
...
2
votes
1
answer
2k
views
Plupload widget type not appearing
This is what I've done so far:
Installed & enabled the Plupload integration module in my drupal website (version 7.x-1.7)
Added Plupload library to my libraries directory (version 1.5.8)
In my ...
2
votes
5
answers
16k
views
How can i add .pdf extention on the default upload files
When i create an article i saw that i'm allowed to upload image files only
Allowed file types: .png .gif .jpg .jpeg
How can i add .pdf file extension and attached with the article?
I'm using zen ...
2
votes
3
answers
3k
views
How do I extract filename and filepath from a file field?
Here is what I am trying to tackle: I would like to allow a zip file to be uploaded via the default filefield upload widget for a content type. I am using hook_node_presave to take the zip file and ...
2
votes
2
answers
2k
views
Server Configuration causes file uploads to fail
I have a drupal 7 site running on a Redhat shared hosting environment that uses zend php. I am having problems with file upload on content types and webforms that accepts various file types up to ...
2
votes
2
answers
375
views
How to disable access to file page (view display mode = full)?
I want to disable access to the view display page of file by url like file/fid.
What's the good way for this? I have tried to use the hook_node_view() but it not called for the files.
2
votes
1
answer
632
views
Rendering a generic file field containing an image
Drupal 7.34
Media 7.x-1.4
Views 7.x-3.8
I have a generic file field. Sometimes the uploaded file is an image, and in these cases I want to render it in a View as a thumbnail.
So I do the following:
...
2
votes
2
answers
1k
views
How can I set-up a custom formatter that uses target="_blank"?
I've installed the Custom Formatters module, as I could not figure out why my View setting was not working for "Rewrite output" -> "Target" -> "_blank"
I need to recreate either the "Generic File" ...
2
votes
1
answer
812
views
Attaching file to node field
I have a problem. I'm trying to attach file to node field by this code
function calculator_page_form_validate($form, &$form_state) {
$file = file_save_upload('file', array(
// Validate ...
2
votes
1
answer
935
views
Where can I find the save destination path for a filefield? (via code)
I have an image file field and I am attempting to write a little script that will programmatically scan my nodes and save images found in the body of my node into an image file field entitled ...
2
votes
0
answers
35
views
Add file path to entity programmatically [duplicate]
I am creating an entity programatically, I want to set a file in entity, I have tried following method.
$file_path = '/sites/default/files/abc123.pdf';
$values = array(
'type' => 'review',
...
2
votes
0
answers
295
views
Video Embed Field module - how do I add attribute 'id' to the embed youtube iframe?
The question is related to DRUPAL modules name is 'Video Embed Field' module.
The default output of this module generated the Youtube iframe embed as set in the config by Administrator. But...
The ...
2
votes
0
answers
151
views
Taxonomy based file path for imce
I've added the field "field_sdb_profile_basics_forv" to my (default) drupal user profile.
Now I need the IMCE editor to detect and choose the file path, based on that field specifically.
As pr ...
1
vote
2
answers
2k
views
Can't Remove Image from CCK File Field when editing node (Throbber just spins)
I was able to upload an image, but the thumbnail didn't appear until I hit save on the form. When I try to remove the image, it just sits there spinning the throbber; if I click on "Save" in the form,...
1
vote
3
answers
934
views
Customising field container
I've created a cck field formatter. The field outputs uploads from filefield into embedded iframes that link to google docs for display. It currently outputs:
<div class="field field-type-...
1
vote
1
answer
80
views
How to remove files using File widget
After clicking on the "Remove" button, the entry disappears, but the file is still on the server.
1
vote
1
answer
285
views
How to add an extra field in file upload widget?
I know that it is possible to enable a description field in the core file upload widget for Drupal 7.
However, I want to add an extra description field like the one already present. For this I've ...
1
vote
1
answer
1k
views
How to migrate fields attached to files?
I'm writing a file migration using migrate/migrate_d2d to migrate files from one Drupal 7 installation to another.
Images have custom fields attached to them, including a text field "...
1
vote
2
answers
3k
views
How to make an uploaded video visible on the node page in drupal 7
I have created a CCK named sample with a field name VIDEOS of type file. I have added a video of CCK type Sample. But it only showed a url after the node is saved.
Instead of displaying the file ...
1
vote
1
answer
1k
views
How to programmatically set a file field to allow multiple uploads/values?
I have created a file field with field_create_field() and added an instance of it to my custom node type with field_create_instance() in my module's hook_install()function. But how do I set it to ...
1
vote
2
answers
1k
views
Link to a file field in the body text?
I have a content type that has a file field. I would like the body field to be able to link to the file. E.g. "Our research (PDF download) shows..." with the link becoming the download path for the ...
1
vote
1
answer
970
views
YouTube thumbnails - options for adjusting interface widgets and behaviour when clicked?
I wish to add YouTube videos to my site as links - I want to use a thumbnail of the video. I'm not concerned with which thumbnail used (as discussed here: How to control preview image in Youtube)
...
1
vote
1
answer
391
views
How do I attach a file to a file field when saving (update/insert) a node?
After creating programmatically a PDF file with TCPDF, I am trying to attach it to my field "file_fichier", here is what my code looks like
/**
* Implements hook_node_presave().
*/
function ...
1
vote
2
answers
524
views
Warning: Invalid argument supplied for foreach() in taxonomy_field_formatter_view()
My Drupal installation has some warnings, I tried several patches, but none of them works for me. These are the warning messages:
Warning: Invalid argument supplied for foreach() in ...
1
vote
2
answers
531
views
Change values of nested fields with entity_metadata_wrapper
The background of this question is that I'm trying to migrate data from Drupal 6 Imagefield Extended to Drupal 7 File Entity (with File Entity Inline). See also https://www.drupal.org/node/974888
...
1
vote
1
answer
1k
views
How to get a remote file and set it as a value for a file field using entity metadata wrappers?
I am trying to get a remote pdf file from a web service and save it as a field's value using entity_metadata_wrapper, but somehow I couldn't get it working.
I can successfully retrieve the file using ...
1
vote
1
answer
288
views
Deleting nodes makes orphan records
I have a content type "event" which has an image field.
I tried to deleted the nodes, but I got the repeated errors when deleted the nodes.
Warning: array_flip(): Can only flip STRING and ...
1
vote
1
answer
250
views
Media/file repository - asset autocomplete widget?
Does anyone know of a module which would install an autocomplete widget for file and image fields on admin-side?
The purpose of it would be to allow admin/editor to re-use a reference to an already ...
1
vote
1
answer
59
views
Display text according to the access to a field
With field permissions, I restrict the access of a field to certain users.
I would like to display some text to inform the user that he has no access to the field.
I tried it in node.tpl.php :
&...
1
vote
0
answers
59
views
YouTube media filed without remove media button
I'm using Drupal 7. The Remove media button on youTube media entry (field) is missing. This is for a field with name: Videos, field type: Multimedia asset (deprecated), widget: Media file selector.
...
1
vote
2
answers
1k
views
How do I migrate CCK filefield?
I'm migrating a Drupal 6 site with CCK filefields to Drupal 7. I installed the Drupal 7 CCK module, and I'm ready to do the migration except for a filefield field.
Migrate fields states:
Missing ...
1
vote
2
answers
836
views
Hide Alt and Title for image field
How to hide Alt and Title fields for anonymus users when they upload images? I use tokens for these field that's why I need to hide them.
0
votes
3
answers
1k
views
Accessing the cell phone camera to populate the profile picture field [closed]
I have a mobile website, and I thought it would be cool if there were a way for the user to take a picture with their phones camera to populate the field rather than have them go and upload a picture ...
0
votes
1
answer
170
views
How to Create a Table of PDFs with Views?
I've been tasked to develop my company's intranet with Drupal. One of the key items is to allow our HR department to upload job openings (PDF's) to display on site. I'm envisioning having this table ...