2

I have a content type "Test" which have "upload file" field. Only for this "Test" content type i want to change the location where uploaded file is stored. I want to store anywhere in my drupal instance not just only in sites/all/default/files/subdirectory.

How can I achieve this.

  • You should not store files outside of the files directory, as that can be a major security hole. If you need to implement a different save location, you can implement a new file stream, or use mohit_rock's solution below. – cam8001 May 14 '13 at 20:53
5

You might find some information about how to code changing file names in the File Path module.

File (Field) Paths allows you to automatically sort and rename your uploaded files using token based replacement patterns to maintain a nice clean filesystem.

enter image description here

  • Added this module. when uploading file getting error "An Ajax Http request terminated abnormally". Error message: PDOException: column not found 1054 – Cindrella Sep 25 '12 at 6:29
  • I am also using this module, but i didn't had any issue. probably you can uninstall and install it again – mohit_rocks Sep 25 '12 at 6:34
0

MaxRequestLen sometimes gets lowered as a result of server/module updates. Also, adding modules that add to the request length can also introduce this problem. This is why disabling modules can sometimes "fix" the problem.

See http://drupal.org/node/1015938#comment-7412202 for a solution that involves updating your vhost file, eg:

<IfModule mod_fcgid.c>
  # 50MB
  MaxRequestLen 52430000
</IfModule>

Or try switching from FastCGI to mod_php or php-fpm (if you're using FastCGI).

  • Not sure how this answers the question? – mpdonadio May 14 '13 at 21:12
  • It would be a response to the AJAX error mentioned in Mohini's comment but for the "column not found" part I didn't notice the first time. So, you're right. But as people come accross this page when Googling "An Ajax Http request terminated abnormally", I'd leave it. I came accross this page when researching that error so it would likely save someone else time. – roberthernandez May 15 '13 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.