All Questions
798 questions
5
votes
2
answers
6k
views
Changing the link title in a view for generic file
I have a bunch of files that are displayed in a view; i'm using 'generic files' setting to display them; the problem is that some files have really ugly names like '1002-32-eda.pdf' i'd like to change ...
5
votes
4
answers
2k
views
Get this jQuery Youtube Playlist working?
Drupal 7. I'm trying to get this to work - seems simple enough. I added the .js file through my theme's .info file, and it's picking that up. I selected "Full HTML" as the format for my block, and ...
5
votes
1
answer
1k
views
Bulk saving nodes with a file field
I'm in the progress of creating a bulk upload function for a Drupal site. Using flash I'm able to upload the files to a specific url that should be able to handle the files.
What I want to do, is not ...
5
votes
2
answers
2k
views
Is there a list of file/image field subtokens?
Token browser does not show the options for file properties. [node:file-field:0:file:url] gets the url, but is there a list of all file options? Or is there a way to check it from sourcecode somehow?
...
5
votes
3
answers
5k
views
Serve static files via S3
I'm developing a Drupal 7 website that will be served from multiple servers behind a load balancer.
I want all static files generated by Drupal cache (JS, CSS, and also theme and modules images) to ...
5
votes
3
answers
3k
views
How to clear unused files from the database and the filesystem?
I would like to have a script that runs on cron, to delete all files that are not currently being used. I noticed that the file_usage table and the hard drive are getting filed with them.
Is there a ...
5
votes
4
answers
3k
views
How to allow for files of any extension to be uploaded?
I'm surprised this hasn't been asked before like this.
I want to allow users to upload files of all file extensions, without enabling each extension by hand. How do I do it?
5
votes
1
answer
15k
views
How to attach Dropzone.js uploads to a form element
I'm integrating dropzone.js into my form, but I have an issue regarding my file uploads. I have my dropzone set up, and file uploads are in the $_FILES array. I want to call file_save_upload to ...
5
votes
2
answers
7k
views
How to Print /PDF entire page
I was wondering if the Print module can be used to print an entire page, not just nodes. I need to add some blocks to the pdf as well, not just the node content.
Is there any way of doing this, or ...
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
4
answers
2k
views
Adding accept attribute to managed_file field to specify file types client-side
I've got a Drupal 7 file field in a custom form like this:
$form['image_upload'] = array(
'#type' => 'managed_file',
'#title' => t('Image upload'),
'#description' => t('Upload ...
4
votes
3
answers
15k
views
Why drupal_realpath('public://') returns an incorrect path?
I am calling drupal_realpath('public://') inside a module function.
Why am I getting a path like sites/all/modules/current_module/sites/default/files from drupal_realpath('public://')?
4
votes
2
answers
8k
views
Import files into a file field in Drupal 7
I have a content type that accepts a PDF document as a file attachment. I have a bunch of entries that currently have no attachment, but I have the files for each entry and need to associate the ...
4
votes
1
answer
5k
views
Why isn't my managed file getting saved?
Please save me from ripping out the rest of my hair...
I've got a "managed_file" field in a form; nothing special. When the form is submitted, I run something like the following code to, presumably, ...
4
votes
5
answers
11k
views
Get fid from file path
I've to create a custom function to display images because I've to add values from custom fields.
I've added a function to template php, like this:
function mytheme_image($variables) {
}
The ...
4
votes
1
answer
10k
views
How to programmatically create new file/folder in Drupal 7 files directory?
I tried to create new file/folder programmatically inside Drupal's sites/default/files. But I'm getting this error: "Can't Open file".
Here is what I'm doing: When my registered user visits a certain ...
4
votes
4
answers
14k
views
How to link to files using a relative path?
My site is in sites/sandbox folder. When I upload to live server, this will change to sites/mysite
In file system settings, the public file system path is set to sites/sandbox/files. When site goes ...
4
votes
3
answers
7k
views
How to programmatically assign (attach) a file to file field while creating/saving the node?
I'm trying to assign (not upload) files to nodes programmatically.
This is the scenario:
I will create 2000 nodes and there are 2000 PDF files (one PDF per node). I don't want to upload these files ...
4
votes
2
answers
8k
views
Programmatically deleting a filefield content and the associated file?
If I do the usual
unset($node->myfilefield["und"][0]);
Would that take care of the actual deletion of the file as well on node_save?
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
2
answers
5k
views
Can't access private files
I have implemented a private file system for users to upload files. This appears to be working as I can see that the file is uploaded into the proper directory. The problem I have is that no one has ...
4
votes
3
answers
10k
views
How do I change the uploaded file name after the node has been saved?
How can I change the name of an uploaded file after the node has been saved?
I know there is the FileField Paths module for this purpose, but it's still buggy for Drupal 7. I looked at the source of ...
4
votes
2
answers
6k
views
Upload a file to Drupal server from an outside URL
I am trying to cache in the server the profile images provided by the Facebook Graph API.
So far what I did unsuccessfully was getting the path of the image then calling:
$file = file_save_upload($...
4
votes
2
answers
8k
views
How do I rename uploaded files?
How do I rename the uploaded files for my module?
4
votes
2
answers
4k
views
File field label
I have created a custom content type that has a file field. When I upload a file the node displays the complete file name, test_file.pdf. I would rather display its file name as clickable link. I ...
4
votes
3
answers
7k
views
How can I rename uploaded files programatically? (auto-rename image files)
I am aware that the File Paths module allows administrators to use tokens to set patterns for renaming files, but as of writing (Jan 2015) there are more than 100 bugs in the queue and no updates to ...
4
votes
1
answer
304
views
Why can't I find my uploaded file on disk?
I have a form with a file upload widget:
$form['myFile'] = array(
'#tree' => false,
'#type' => 'file',
'#title' => t('Choose a file')
);
In the form validation handler, I upload ...
4
votes
2
answers
1k
views
Fetch images across the internet with File API
How can I use the FileAPI to fetch an image from another website via URL, and bring it into Drupal? Here is what I tried:
foreach ($data['photos'] as $item) {
$photo = file_get_contents($...
4
votes
1
answer
585
views
Which function(s) actually create the physical resized image files?
By default, Drupal 7 ships with 3 images styles: thumbnail, medium, and large.
For example, I upload a image file ('abc.jpg') with the image field (I assume the field name is called 'image'); while I ...
4
votes
1
answer
759
views
Video upload via FTP
The Video module for Drupal 6 allows for video files uploaded via ftp to be played. Does this module's Drupal 7 version have this feature? If not what is the work around for large files?
4
votes
2
answers
6k
views
How to show only an image of the YouTube video while using Media: YouTube module?
Is there a way to show an image of a youtube video instead of the actual player ? This would be done only for the teaser view of the node.
I know that I can show a video thumbnail, but I need an ...
4
votes
3
answers
3k
views
Private files not found 404 error
My installation is Drupal 7 + Nginx + Varnish cache
My private files path: sites/default/files/private/demo.img
URL in browser: system/files/demo.img
When I try to open private file: http://domian....
4
votes
1
answer
2k
views
file_usage_add: custom type for my module
I have a custom calendar module I've created. When a user creates an event they have the ability to attach a thumbnail image to it. I'm trying to make it use the managed_file type. In the ...
4
votes
2
answers
1k
views
Exist a Drush command to update all the contents?
We have a client who was adding content to a separated dev server, the dev server is whitelisted only and doesn't allow incoming/outgoing connections to a lot of services.
The client was adding ...
4
votes
1
answer
366
views
A module for generating PDFs
I have tried PDF using mPDF and Printer-friendly pages (Drupal 7.x). They both need own styling of an output. I have got a CSS that formats my pages for printing. I would like to generate PDFs by just ...
4
votes
2
answers
7k
views
How do I set the custom upload directory for a plupload from field?
My module uses a plupload form field. I'm trying to define a custom directory for my plupload uploads.
A normal upload form for a managed file looks something like this:
$form['managed_file'] = ...
4
votes
1
answer
2k
views
How to get the Object based on File ID (FID)
I'm inside mytheme_image_formatter($variables) function and I got the image's FID (from $fid = $variables['item']['fid']).
Question:
Is there a way to know which object is using the image file?
...
4
votes
2
answers
2k
views
Organize files attached to a node into folders
We need to organize files attached to a page into folders (with Drupal 7). They don't necessarily have to be physical folders, virtual folders are fine.
Do you know a module like this, or do we have ...
4
votes
2
answers
1k
views
Managing user disk space
I need a mechanism for managing users' storage space. I have multiple content types with file upload fields. Admin should be able to set it globally, or per individual user.
My initial approach is ...
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
2
answers
683
views
How can I restrict that only sender and receiver can download the attached file with the private message?
I am using drupal 7. I created a new file field in private messages for attachments and I want that only sender and receiver should be able to download the file attachment.
I apologize if this ...
4
votes
3
answers
995
views
How do I add code to browse for a file in a Drupal Form?
I am trying to add items to a form (in code) similar to the add image item in the Drupal Add Content form that has the Browse and Upload buttons. In Firefox, the Browse button invokes a Pop-up window ...
4
votes
1
answer
955
views
Video conference module
I have some doubts about the Video Conference module.
Can we integrate the video conference module in Drupal 6?
Can we use Dokeos for video conference?
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
2
answers
2k
views
How to scan a directory to list all sub folders not files
I have a folder (root folder) with thousands of sub folders and *.json files inside sub folders. How can I get list of sub folder names inside folder (root folder) using file_scan_directory?
4
votes
1
answer
937
views
How to avoid appending incremental number to filename
I don't want Drupal to add incremental numbers to my file names to make them unique. I want to always have files stored with the same name they had when I uploaded them.
If the file with given name ...
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 ...