Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
153 votes
10 answers
215k views

What are the recommended directory permissions?

I'm gearing up to deploy a Drupal 7 site and I can't find any documentation. What are the recommended security-conscious permissions for files and directories? I am specifically interested to the ...
ack's user avatar
  • 2,149
55 votes
19 answers
155k views

Configuring the temporary directory

I have recently moved a site from a localhost to a VPS. I have managed to make the public and private files writable; however, I am not sure where to find the temporary folder and how to change the ...
Jasmine Ahmed's user avatar
47 votes
4 answers
58k views

How do I get the path for public://

I need to get the path for public:// at runtime. Is there a function I can use to get it?
vintorg's user avatar
  • 1,993
41 votes
1 answer
19k views

Managed file: the file used in the field may not be referenced

I am having some issues with the managed_file type. Whenever I try to edit and save a form that has a managed_file element in it an error occurs: The file used in the Picture field may not be ...
Bart's user avatar
  • 6,944
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->...
Smos's user avatar
  • 647
22 votes
4 answers
30k views

How to check if (unmanaged) file exists?

I can't find a Drupal API function in D7 that tells me if an (unmanaged) file exists. D6 had a file_check_location but not for 7. How to check if (unmanaged) file exists?
uwe's user avatar
  • 12k
22 votes
7 answers
16k views

How to find orphaned files and images which are not linked from any css stylesheet or from any node?

Is there a way to list all unused files which reside inside public file system and inside a theme directory and list them, or maybe even have an option to delete them automatically? I mean files ...
camcam's user avatar
  • 2,121
21 votes
1 answer
1k views

Mass image upload with Storage API and Services API

I am trying to set up a site that will be storing a large amount of images (roughly 50,000 to start with). The strategy for this was to use Storage API and S3 storage to deal with the costs of hosting,...
Mike Cooper's user avatar
16 votes
3 answers
15k views

Given a File ID (fid) how can I get the HTML that represents that fid?

I'm looking to do something like this $fid = 15; $file = (array)file_load($fid); $content = drupal_render($file); echo $content; file_load() drupal_render() And specifically this fid is from the ...
mikeytown2's user avatar
  • 8,322
12 votes
5 answers
14k views

How to change File field icons (without changing core)?

The generated markup for displaying a file field is (PDF in this example): <img src="/modules/file/icons/application-pdf.png" title="application/pdf" alt="" class="file-icon"> I'd like to use ...
pushka's user avatar
  • 1,853
11 votes
6 answers
10k 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, ...
Boriana Ditcheva's user avatar
10 votes
3 answers
21k views

Image Upload in a Custom Module

I'm writing a custom module, and I need it to upload an image. I'm having trouble finding good documentation on this, but I think I'm close. What am I missing? $file returns false in the form ...
Tim's user avatar
  • 203
10 votes
5 answers
19k views

Preview image after uploading using Form API

I uploaded an image file using the managed_file Form API type, but after uploading the image it does not appear as a thumbnail beside the field. What is rendered is the file name of the image with a ...
Ahmed's user avatar
  • 1,439
9 votes
3 answers
4k views

How to configure D7 so files get uploaded to a different server

In Drupal 7, the default path for uploading is set in the File system options in the Public file system path. Is it possible to specify a different server in this path? I have a Drupal 7 web site we ...
John81's user avatar
  • 594
9 votes
3 answers
21k views

Form Api File upload

I have the following code in my form. $form['new']['upload'] = array( '#type' => 'file', '#title' => t(''), '#size' => 40, ); On the submission handler, it returns the file name but ...
Lucy's user avatar
  • 1,502
9 votes
4 answers
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?
Adam S's user avatar
  • 5,031
9 votes
2 answers
8k views

Warning: file_put_contents(temporary://): failed to open stream [duplicate]

I get this message from Drupal: Warning: file_put_contents(temporary://file8vyLsO): failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in ...
natttan's user avatar
  • 163
9 votes
1 answer
4k views

Will managed files be deleted if no corresponding entry exists in file_usage?

I am using the services module to implement a REST API. One resource allows POSTs with uploaded files. During a services pre-process function I save the file to the temp directory. During a ...
lkiss80's user avatar
  • 473
8 votes
6 answers
10k views

Attaching existing server files to filefield

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, FileField Sources seems to do this. Does FileField Paths or IMCE ...
brian_d's user avatar
  • 317
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 ...
Pari's user avatar
  • 492
8 votes
1 answer
4k views

Upload progress on nginx

I am using the latest version of Drupal 7 and my webserver is Nginx. I checked the status report and it says: Upload progress Not enabled Your server is not capable of displaying file upload ...
Ruriko's user avatar
  • 615
8 votes
4 answers
9k views

Why does the favicon sometimes not show up and generate "page not found" errors, and other times does show up

As the question implies, on occasion Drupal's log is showing that the favicon is not found. Indeed, it does not show in the browser tab or address bar. At other times, even within the same surfing ...
authentictech's user avatar
7 votes
1 answer
7k views

How does the tmp folder work? It stores lots of junk files and takes space

My tmp folder is set to /sites/default/files/tmp/ and I checked what's inside and for example there is folder inside called /update-cache-b2903cc4/ it keeps all modules in .zip that I installed via '...
user13176's user avatar
  • 740
7 votes
4 answers
9k views

Using theme_image_style()

I am trying to display thumbnails of uploaded images in a custom form. While I can see the images in my form array after uploading them to the tmp directory in Drupal, here is what I am trying to use ...
Kevin's user avatar
  • 28k
7 votes
6 answers
12k 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 ...
qasimzee's user avatar
  • 378
7 votes
1 answer
7k views

Read contents of uploaded file before saving

I am using hook_node_presave() to build a module (which I am new to) in Drupal 7. I am able to reference fields via $node->field_foo[$node->language][0]['value'] (which I have seen mentioned ...
user1706487's user avatar
7 votes
2 answers
7k views

File issues after importing Drupal site

I recently tried to move my Drupal site to a new server using this page: Moving Drupal 7 site to a new server. But now the style doesn't seem be loaded and more importantly I get this error on every ...
Mike2012's user avatar
  • 1,761
7 votes
2 answers
3k views

Public and temporary files error in my "Status Report"

I just upgraded to 7.25 from 7.19, and now in my Status Report I have a red X on my "Public Files" and "Temporary Files". See http://drupal.org/SA-CORE-2013-003 for information about the ...
EGHDK's user avatar
  • 315
7 votes
2 answers
5k views

Managed file: What is the proper way of setting #default_value?

$form['picture']['file'] = array( '#type' => 'managed_file', '#title' => t('picture'), '#description' => t('Allowed extensions: gif png jpg jpeg'), '#default_value' => (isset($foo-&...
Jayjay D. Luffy's user avatar
7 votes
3 answers
7k 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 ...
longboardnode's user avatar
7 votes
1 answer
5k views

Why is Drupal deleting my images?

I have images going mysteriously missing from my Drupal site, sometimes several all at once. There are currently only two people who have access to edit these, myself and a manager in Corporate ...
iconoclast's user avatar
  • 1,809
7 votes
3 answers
6k views

Multiple/Bulk Image Upload Tutorial? Plupload etc [closed]

I want my users to be able to upload multiple images at once. They need to be able to upload 60 images for one gallery and doing that one at a time is just not feasible. I've been reading other posts ...
Kenny Wyland's user avatar
  • 3,058
7 votes
1 answer
2k views

Upload multiple files through a single file dialog?

In a Webform, I want to let the user upload multiple files via one call of the file dialog. I found the following modules. Webform Multiple File Upload Webform Multiple File With either of them, I ...
Georg Jähnig's user avatar
7 votes
2 answers
4k views

Media + WYSIWYG or ICME + CKeditor

I need to build quite feature rich set of tools for file & media management both for embedded and stored files in a new D7 project. Media will be added to both fields and in the WYSIWYG and File ...
WestieUK's user avatar
  • 3,838
6 votes
4 answers
8k views

How do I implement a VIDEO gallery like gallery formatter but with videos?

I need to implement a gallery of videos in DRUPAL 7 like gallery formatter in Drupal 7 but with videos. The videos are from YOUTUBE. I created a content type named "video" and I have used the module:...
cabita's user avatar
  • 991
6 votes
1 answer
485 views

What happens if a user uploads an image but doesn't save the node?

I would like to know what happens if a user uploads an image by image field but doesn't save that node? It seems that image will be in the directory but no node refers to it. Is there anyway to ...
M a m a D's user avatar
  • 3,837
6 votes
1 answer
6k views

How do I restrict uploaded images to a specific aspect ratio?

What I would like to do is, using the Image field in core, to restrict uploaded images not just on resolution, but also on aspect ratio. In other words, the image must be 2:3 width to height, and at ...
ezrock's user avatar
  • 391
6 votes
2 answers
907 views

Drupal files folder owner/group for CentOS?

This is my first time installing Drupal on CentOS. I know for Ubuntu it needs to be www-data as the /files folder owner, but what is it for CentOS?
No Sssweat's user avatar
  • 31.6k
6 votes
1 answer
6k views

How to save an uploaded image in an admin form?

I wrote the following module to upload a background image. My problem is, that my submit function is not called, though the pic is uploaded and showed in the block until the next cleanup is coming.The ...
Jurudocs's user avatar
  • 702
6 votes
2 answers
4k views

Mixed public/private file upload

In Drupal 6, the Private Upload module allows you to specify that a node file attachment should be stored in the private file system, so that it is not directly accessible by URL. There is a checkbox ...
Dan Halbert's user avatar
  • 1,009
6 votes
2 answers
887 views

My PECL uploadprogress bar appears, but why doesn't it show any progress?

I installed the PECL uploadprogress bar in php and this is working fine but when I start uploading a file it ends up getting stuck and dissapearing when the file is uploaded. This is what i see when ...
Stefan's user avatar
  • 583
6 votes
1 answer
984 views

IMCE: Prevent deletion if file is in use

Does any one know of a way to prevent a file from being deleted through IMCE if the file is in use? I saw this feature requested http://drupal.org/node/628246 and there is a comment to state that ...
nmc's user avatar
  • 2,077
6 votes
2 answers
10k views

open_basedir restriction in effect despite file directory within web root

When trying to upload a logo to my Zen 3.1 subtheme (Appearance > Settings) I get the following error: Warning: is_file(): open_basedir restriction in effect. File(/tmp/phpillr69) is not within the ...
Michał Pękała's user avatar
5 votes
1 answer
8k 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 ...
Mike2012's user avatar
  • 1,761
5 votes
2 answers
11k 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
kkatusic's user avatar
5 votes
2 answers
1k 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 ...
Ismail H's user avatar
  • 389
5 votes
2 answers
7k views

How is the file data in the database table file_usage created and managed?

I am deleting orphaned image files in Drupal 7, but I have to first cross reference them to other tables that might be using the images. Given that I don't upload any images via the IMCE editor ...
Patoshi パトシ's user avatar
5 votes
3 answers
2k views

File structure for custom modules in Drupal 7

I want to organize non-core (modules that are not bundled with core) modules in Drupal 7. This is my proposed structure: Contributed modules - downloaded modules that are untouched Custom modules - ...
Bhavik Shah's user avatar
5 votes
5 answers
4k views

Drag & drop files into drupal site?

Does anyone know of a module that allows to drag files from users computer into a target area in site (like in gmail or wordpress)? ideally this would work with Image and other modules to insert the ...
Moshe Eshel's user avatar
5 votes
4 answers
2k views

Possible to make image styles (thumbnails) public while original images are kept private in D7?

I love the fact that D7 allows you to choose whether files should be stored in the public or private file system on a per-field basis. But here's my question: is it possible to have image files that ...
Jordan Magnuson's user avatar

1
2 3 4 5
16