How to store Blobs in Drupal? - drupal

I want to store PDF and Image files in Drupal. By default Drupal seems to store binary/uploaded files into the filesystem. I want to to be able to store files so that - I can have workflows, metadata, IP information and URL aliases?
Update, am still stuck at how to create URL aliases for files on the file system. Drupal only seems to allow creating URL aliases to node content.

The simplest solution for Drupal is to use the Upload module, which is in core. The upload module allows you attach files to nodes. As you note, they are stored in the filesystem.
If you want to get more complex, you can build your own content types through the web interface by using the CCK family of modules (such as the filefield module or the imagefield module). Your files are still stored on the filesystem.
You could use CCK to create the metadata field you want.
You could use the workflow or rules modules to implement workflow.
IP information is recorded automatically by Drupal's logging module (either the database logging module, which logs to the database, or the syslog module, which logs to syslog).
URL aliases for nodes are available in core Drupal by enabling the path module (or download the pathauto module for automatic creation of aliases).

I tried Drupal's Upload module, FileField as well as uploading files using FCKEditor - I prefer the last one - it is closer to my specific scenario.

Creating an alias to the file will likely require some custom code.
It's not possible to simply create an alias using the Administer > Site building > URL aliases screen. I tried inserting a record with
insert into url_alias (src, dst) values ('sites/default/files/ChipotleArt.JPG', 'here-is-the-file.jpg');
That still didn't work. So, you will really likely need to write some custom code.

Related

Drupal 8 to publish files

I'm trying to create a simple CMS to ingest contents and publish files. I'm using Drupal 8 with Feeds module to read xml files from a directory and it works fine.
I can't figure it out how I can take the information saved in my custom content and publish them to a file in another directory.
Anyone can help?
Thx
Luca
Could you create a view to render the desired output for the content you're after and then use the Views data export module to export that view into a file?
I note the following:
This module also exposes a drush command that can execute the view and
save its results to a file.
drush views-data-export [view-name] [display-id] [output-file]
If you can do it with Drush you can do it with PHP.
So potentially you could write hooks to manage the export of files based on the activity of the feed. E.g. The hook_ENTITY_TYPE_insert would allow you to perform logic when a node of a particular content type is created.

Set Doctype of new upload files using FTP in alfresco

I am using alfresco-5.2.I have enabled the FTP in alfresco,and able to upload the files successfully.but those are coming without type can anyone tell me how to set doctype and metadata for file.
FTP allows you to upload the file and that's about it. Similar to copying via WebDAV or CIFS. If that is your only option you will have to follow Gagravarr's suggestion and add a folder rule to the folder that specializes the type and sets the properties as you see fit (in Share, go to the folder and click "Manage Rules").
If code is an option then you should use CMIS to upload the documents because CMIS will allow you to set the document type and set custom properties. There are CMIS clients for a number of languages including Java, Python, .NET, and others. The most widely-used client libraries can found at the Apache Chemistry project.

Restrict Alfresco upload to specific file extension (ex: users can only upload PDFs)

I want to prevent my Alfresco 5.1 users from uploading anything else than ".pdf" and ".xslx" files.
What is the best way to implement that in Alfresco?
Is there a setting, or do I have to write some Java code?
Filtering must be done on the file extension, regardless of MIME types. The restriction must apply via FTP too.
You can't do this through simple Alfresco configuration. I'd suggest writing a Behaviour that would implement this logic. It will get triggered no matter how something ends up in Alfresco (Share, FTP, custom application, etc).
http://docs.alfresco.com/5.2/references/dev-extension-points-behaviors.html
You can not restrict throught FTP. Some ftp client provide file name filter facility,Using that you can Restrict.In alfresco try to create rule ,on that rule execute script ,that script contain code to delete file which is not allow.

Drupal6: I need to customize file upload links in node edit form

I am customizing the node/add and node/edit forms of a content type with a form_alter. In my content type, there is a file field that permits to upload files to the content.
What I would like to do is to customize the file box by changing the link to the file that is composed at runtime with Ajax. How can I do it without modifying Drupal core?
Your Private Files directory should not be in the docroot. Hiding it with a .htaccess rule will not work, as you point out in a comment.
Say you have Drupal in /var/www/sites/example.com/, then you should not store your private files under that directory; /var/www/sites/example.com/sites/default/private/files/ is just plain wrong.
You should, instead store the files where apache will not serve them, but can read them. E.g. in /var/www/files/example.com/. Then change the setting in Drupal to use that absolute path.
If you are running a large(r) site, you will probably want to store your files on a dedicated mount (drive, NFS etc.), say /media/nfs-example-com/.
Try Filefield Paths:
The FileField Paths module extends the default functionality of Drupals core Upload module, the FileField module and many other File Upload modules by adding the ability to use node tokens in destination paths and filenames.
http://drupal.org/project/filefield_paths

How to attach local files to Drupal nodes

I need to attach video files to nodes in Drupal 6, yet the AJAX uploader fails (the dreaded HTTP error 0), and anything I tried to debug it didn't help (may be moving to Drupal 7 will, but that's still going to be some time). Is it possible to somehow upload the file to the server via FTP, and then simply attach it to a node, so that it is linked in the same way that it would be linked after a regular file attachment?
This is not about CCK's FileField. This is about the "vanilla" node attachments. To do the same for FileField uploads I used FileField Sources module, and I'd like to find a similar solution for the node attachments.
your problem is in limit upload file size.
check it is in php.ini settings
do not forget that max package size limits upload size too
check drupal settings (drupal file system settings or filefield settings)
I believe I had something like this problem when I configured a site to run over SSL but not all the URLs in the system were being properly adjusted or redirected. I set the $base_url variable in settings.php to use https://www.example.com` and the error stopped.
In my case I believe it related to a Taxonomy tagging autocomplete callback, but all Ajax callbacks in the system can be sensitive on this point.
#646694 AJAX: Terrible reporting of status 0 response from AJAX request ("HTTP Error 0 has occurred")
Since I couldn't find a solution, I had to switch to using CCK FileField, and use FileField Sources module (http://drupal.org/project/filefield_sources) to upload files to the server and then attach them to the field.
Thanks for trying to help me, guys!

Resources