The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [files]

Use it to generally reference to those files used on websites which could be video, images, pdfs, etc.

Filter by
Sorted by
Tagged with
2
votes
1answer
797 views

Set image as permanent in custom block plugin, temporary URI

I'm building a custom block plugin with an image upload which is working fine except for the fact that although the $file->status is set to permanent the URI still comes up as temporary. This is the ...
1
vote
2answers
10k views

Private File System and User Access

Is there a way to protect Drupal files from being accessible by the file path (putting http://www.domain.com/files/image.jpg) in the browser URL from users poking around?
1
vote
1answer
540 views

How do I attach an existing file to a node?

Here's my problem. I have a D6 site which has been in production for a number of years, and in consequence has used various methods (and modules) for displaying images within body text of book pages. ...
1
vote
1answer
1k views

How can I make Plupload in D7 start uploading automatically?

I'm using the Plupload integration module and the problem is that once the users select the files, they think that they have already uploaded the files. No matter how obvious, bold and huge you make ...
1
vote
1answer
567 views

FileField Database

I like the idea of using a field within a database to hold a file. Is it possible to store files within a database instead of within folders with Drupal 7? My current setup is Drupal 7, Ubuntu ...
0
votes
1answer
2k views

Switching file system from private to public makes all inline image paths broken

I built a site with private file system initially, but now want to switch to public so that I can use performance enhancements like css and js minification as they are not available for private file ...
6
votes
3answers
1k views

What is the fastest way to convert a large volume of documents (.html) to drupal nodes

How would you go about creating a large number of nodes from a large number of html documents? I am trying to create something similar to a book and have a lot of .docx files on my computer. I am ...
5
votes
2answers
9k views

File upload with ajax

Is there any example how to set up form element with type file to upload it via AJAX. I want to be same as field image in node type article. thx
4
votes
1answer
2k views

How do I hide /sites/default/files from URLs?

I want to upload files to their normal directory under /sites/default/files/. So let's assume I have example.pdf uploaded to sites/sites/default/files/manuals/example.pdf. I want the links to files ...
22
votes
6answers
15k views

How to upload multiple files at once?

We need to upload multiple files of different types, is there a module that will check for valid mime types and upload only the valid files, (based on site settings, eg: png, doc, jpg, txt) ?
21
votes
3answers
34k views

How to get drupal 7 default file upload directory?

I have trouble to get the upload directroy from drupal. Is there some function returning the relative or absolute path?
7
votes
3answers
31k views

How do I get the public url of a file from the uri or filename

I'm using php from with a view (Views PHP) I'm trying to extract the real url of a file from a file reference. I am able to get the the uri of the file and or the filename. What drupal function can I ...
12
votes
2answers
25k views

Where are temporary files created?

I want to know where Drupal (or its modules) create temporary files. Are they put in sites/default? I'm especially talking about Drupal 6.
10
votes
4answers
13k views

How do I add embedded YouTube videos in a field?

I would like to have a field for adding YouTube videos; however, I do not want to use the Media module because it is very buggy at this point. Is there any alternative for Drupal 7?
9
votes
1answer
3k views

Load a file entity by URI

Is there a way to load a file by URI in Drupal 8? In Drupal 7 it is possible by the next example: $uri = 'public://file.xyz'; // Take a look at: file.inc::file_load_multiple $files = ...
9
votes
6answers
8k views

Files attached to nodes are never deleted from server even after they're removed from the node (and that edit is saved), Drupal 7

I've noticed something strange on my site: after attaching a file to a node (via the regular file field), that file never gets deleted from the server. I remove it from the node, save that change, ...
4
votes
2answers
2k views

Allow downloading files from private filesystem when paths to files are built without Drupal

I have set up files under private filesystem (large tree of dirs and files). Drupal does not know anything about those files, because they are not added by file upload field, but links are manually ...
3
votes
6answers
9k views

CKEditor simple image upload functionality

I'd like to have a simple, one-click, image upload functionality with CKEditor. I'm using D6 and CKEditor 3.6.1. I do not want a server file browsing functionality, only uploading images from the user'...
8
votes
1answer
2k views

Prevent file renaming

I have a user who is uploading a number of files with the same file name. It is important to them that the files are never renamed. However, the files are getting _1, _2, etc on the end. Is there a ...
8
votes
2answers
5k 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 ...
7
votes
3answers
6k views

File save upload doesn't replace existing file despite FILE_EXISTS_REPLACE

I'm trying to force replacement of existing file with same name, if a new version is uploaded by user. I've seen a lot of posts about this topic but none that I could find addresses how to force the ...
6
votes
3answers
4k views

How to get the File Description programmatically?

In Drupal 8, like Drupal 7, you can enable the file description in the file field setting. But once my file entity is loaded in my preprocess, I don't know how can I get the description value entered ...
5
votes
2answers
794 views

How to download programmatically a module?

I need to programmatically download projects from drupal.org, and then eventually enable it with modules_enable. Anyone knows how to do it? Here's the final solution : I'm sharing the code i used for ...
5
votes
1answer
2k views

How can I PUT a new file to a node using services 3 without overwriting the existing file?

Using Services 3 I have it working fine to add a file using endpoint/file {"uid":"1","filesize":"99999","filename":"whatever.bin","file":"BASE64_ENCODED_DATA"} and also to add a node with that file ...
5
votes
1answer
7k views

Creating a file object from a file already in public:// (drupal 7)

I am currently writing a module that will unzip a .zip file after it has been uploaded. Once this file is unzipped I want to search through it and find certain types of files and create content types ...
4
votes
1answer
745 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
2answers
1k views

Give access to private files to certain role?

I have a few image styles set up. But they are all stored as "private" files. I want to be able to give anonymous users public access to these files, or find some other way by which to generate access ...
4
votes
1answer
879 views

Store Drupal files outside of the root

My website is running on Windows and it sits on drive C:/, however I'd like to keep all my files on drive D:/. How can I do it? I know that I can move the whole site to drive D:/ but I was wondering ...
3
votes
2answers
3k views

Extract zip to server and upload the files to the node?

I allow users to upload zip files I extract, and look into them to see if they contain a .jpg file. I use that file to create a new node. The differences between the .jpg and the .zip file uploaded ...
6
votes
4answers
1k views

Replicating an existing table-based form as PDF views output?

The Drupal 6 project I'm working on involves a custom content type with a bunch of different elements. I'm needing to replicate an existing form -- see screenshot. Ultimately, I need to take the ...
4
votes
3answers
3k views

How to upload static files to a remote server in Drupal 7 instead of local filesystem?

I've recently had to migrate from Django to Drupal 7 due to web server constraints. One of the aspects of my old Django setup that I would like to preserve is hosting static content like images and ...
4
votes
5answers
10k views

Can you create a view to display all files within a certain directory?

I have a Node Type A that is referred to by a bunch of other nodes. Within the nodes that are referring to Node Type A, there are various and separate CCK file fields. I have configured all of these ...
4
votes
3answers
3k views

Access denied to file in sites/all/default/files

I am getting: access denied 04/30/2013 - 16:56 sites/default/files/styles/thumbnail/public/KRIS... admin in my error message log when trying to do some file updating. I am guessing this is a ...
4
votes
1answer
2k views

how to delete the files uploaded in the file field?

if i remove the files that were uploaded in a File field,and then upload a same name file, the file removed just now is still present in the server and the new uploaded file gets renamed to a name ...
4
votes
2answers
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
1answer
2k views

how to display the uploaded zip file content in drupal?

i created a cck file field and i uploaded zip file in that content type. Now i want to display the content of zip files after uploading the zip files. i don't know how to implement it?. can you tell ...
4
votes
6answers
9k views

How to remove “Show row weights” option on File Upload field?

I have created a file field with multiple uploads allowed. Is there any way(except CSS) I can remove "Show row weights" link from file upload field? Or is there any way to remove weight drop down ...
3
votes
3answers
935 views

Is the “size” field in file_managed used for anything?

I'm having to import videos and video thumbnails manually to the file_managed table since there is no migrate support for it yet. I'm wondering if the size is really used for anything?
3
votes
3answers
8k views

How can I get the URL to the public files directory?

I can get the path to the public files directory by using Filesystem::realpath: $path = $filesystem->realpath('public://'); But how can I get the URL of public://?
3
votes
1answer
4k views

How to display list of files under a particular directory in Drupal?

I've created a custom module to export node data of different content types into Excel (using PHPExcel hooks). That will be stored into particular directory called "Reports" under site/all/files ...
3
votes
3answers
7k views

Webform File Upload field

I'm using Drupal 8 with Webform module. I want to allow users to upload one or several files when filling the form. Is it possible with Drupal 8? May be some additional module required for this?
3
votes
2answers
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 ...
2
votes
2answers
2k views

Where can I find custom content type templates file?

Sorry for ask this easy question, I know the net its full of tutorials, but the info is a bit confusing since they are always showing the diference between D7 and D8 (i didn't use a CMS before so it ...
2
votes
1answer
219 views

How do I control the file appearance using File Entity?

By installing File Entity module I was hoping to be able to control the way all file items are rendered, for instance I need: file rendered as a link wrapped inside an <li> element, or a link ...
2
votes
0answers
215 views

Student TV channel - embedding YouTube videos

As you can guess from the title, I'm the new webmaster for a student TV channel and I need to update the site. The site needs to pull in YouTube videos from a channel, embed the video player and ...
2
votes
1answer
12k views

Where is tmp file directory?

Strangely I cannot find this directory anywhere inside sites or files. There is only one in /var would that be it? I need to edit the .htaccess as it states in my reports. Also what ownership and ...
2
votes
1answer
277 views

Overwrite file_directory_temp function without touching the core?

I need to modify the file_directory_temp() function, but I can't touch the core. My drupal-site runs in Microsoft Azure Cloud and I need to exclude all temp files from drupal-root into a absolute ...
2
votes
1answer
2k views

Is there any harm is manually modifying file_managed status?

I'd like to manually change the status column of a record in file_managed. The file URI is located in a permanent location. I simply forgot to change the status to 0 before performing file_save. I ...
2
votes
1answer
332 views

In the File Entity module, what is the purpose of multiple “Enabled displays” and “Display precedence order” for a single display mode?

In the File Entity module, what is the purpose of multiple enabled displays and Display precedence order for a single display mode? Or what is the use case where I would need to provide multiple ones ...
2
votes
3answers
4k views

How to reorganize drupal sites/all/modules structure without symbolic links?

Context: As the number of modules used increases, I try to reorganize modules in /***/sites/all into sites/all/modules/contrib sites/all/modules/custom sites/all/modules/dev subfolders as it is ...