I have a need to have uploaded files on a different mounted drive than the webserver. I created a symlink to the new path, which works plus with an error.

Under configuration/file system, the "Public file system path" was sites/default/files. This is where the files were.

I created another folder, not in the webserver, called /mnt/raid1/files which is where I want my uploaded files to be stored.

I created a symlink and put this in the above mentioned field. The result was a) the file was uploaded to this directory, but I also received a PDOException: SQLSTATE 23000 error:

An AJAX HTTP request terminated abnormally.
Debugging information follows.
Path: /drupal/file/ajax/field_doc_file/und/form-YeAnl00VFzmdyv8ldr8PAanT0NBlbeCQx2MAQjb60GU
StatusText: n/a
ResponseText: 
Error  
Error message
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://doc/Notice' for key 'uri': INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array
(
[:db_insert_placeholder_0] => 1
[:db_insert_placeholder_1] => 007 - Notice of case mgmt & order to show cause hearing.pdf
[:db_insert_placeholder_2] => public://doc/Notice.pdf
[:db_insert_placeholder_3] => application/pdf
[:db_insert_placeholder_4] => 198575
[:db_insert_placeholder_5] => 0
[:db_insert_placeholder_6] => 1321758460
)
in drupal_write_record() (line 6868 of /opt/lampp/htdocs/drupal/includes/common.inc).
The website encountered an unexpected error. Please try again later.    

ReadyState: undefined

Forgive me if the answer is simple, or if I am not supposed to use symlinks like this, but it seems like it would handle my problem. Suggestions?

Comments

marcingy’s picture

Status: Active » Closed (duplicate)

See #1008402: Allow the use of symlinks within the files directory. d7 does not support symlinks currently.

KingSalibah’s picture

I applied the patch at the above link, and it seems to have solved my problem. I am currently using symlinks successfully as per other thread.