Unable to upload "because the destination is not properly configured"

lectric - May 10, 2006 - 06:02
Project:Audio
Version:6.x-1.x-dev
Component:Miscellaneous
Category:bug report
Priority:minor
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

I'm sure I've done something wrong, but I don't know what it is. I have everything set-up as best as I can, but I get this error:

    * The selected file /tmp/tmp_swAcPL could not be uploaded, because the destination /tmp/audio/breathing.mp3 is not properly configured.
    * The following errors where encountered while reading the file's ID3 tags:
          o Could not open file ""
    * Title field is required.

Can somebody please put me back on track?

thanks

evan

#1

drewish - May 10, 2006 - 20:45

that looks like some kind of permissions problem with the webserver in the temp directory. have you had any luck uploading with the upload module?

#2

lectric - May 10, 2006 - 21:12

Yes, no problem with upload module. Video module working well also. php upload limits sky-high. I evan put a tmp/audio directory at the root of public_html to test and see if that was the problem and even chmoded to 777 and still the same result. Where exactly does this tmp/audio directory normally live?

#3

lectric - May 10, 2006 - 21:41

OK, I went back and checked. I'm using attachment and filemanager, not upload. However, I enabled them upload module. Then in audio content type I enabled both "attachments" that appear after enabling upload module. Then I configured upload to allow .mp3. I created a tiny mp3 so file size is irrelevant. Still get the same errors. In the drupal admin log I see three new lines each time I try to upload an audio file:

error file system 2006-05-10 21:37 The selected file /tmp/tmp_c2SAMX could not ... evan
error file system 2006-05-10 21:37 The directory /tmp/audio is not writable, ... evan
error file system 2006-05-10 21:37 The directory /tmp/audio is not writable, ... evan

help! It looks like something is wrong with the destination directories, but I don't see those listed directories (tmp/audio) in the root of public_html. There is a tmp director at the root of the virtual server, above the public_html directory.

#4

lectric - May 10, 2006 - 21:46

I also disable attachment and file manager. I also reset ID tags setting to default. Still get the exact same erros in the log. Here is a more verbose error message:

details
Type file system
Date Wednesday, May 10, 2006 - 21:44
User evan
Location http://bcgeu.catalystinternet.ca/node/add/audio
Referrer
http://bcgeu.catalystinternet.ca/node/add/audio
Message
The selected file /tmp/tmp_LUopDi could not not be uploaded, because the destination /tmp/audio/audio.mp3 could not be found, or because its permissions do not allow the file to be written.
Severity error
Hostname 24.69.172.10

#5

drewish - May 11, 2006 - 05:24

yeah it should be using /tmp (the server's temp directory) to store the files you've uploaded. it then tries to move them to a directory in temp named audio. if you said that the directory doesn't exist, then it looks like that's where the error is occuring. maybe you could try creating the directory manuallly and see how that works?

#6

lectric - May 12, 2006 - 03:49

Still throws the exact same error. Same on two sites now on the same host. The directory tmp site next tp public_html and is world writeable. I put an audio directory inside which is also world writeable. Any other ideas? .htaccess file issues? php.ini issues?

#7

lectric - May 12, 2006 - 03:50

sorry..in a rush...the tmp directory sits next to the public_html directory.

#8

drewish - May 24, 2006 - 01:08
Title:stumped by error» Unable to upload "because the destination is not properly configured"

see also: http://drupal.org/node/65211

renaming this to make it easier to find.

#9

drewish - May 24, 2006 - 01:29

a few questions:
* do you get this error on preview, on submit, or on both? (i'm assuming both)
* do you see any errors listed on the admin screen that might be related?
* can you try changing drupal's temp directory to drupal/temp or something like that?

#10

jeforma - May 24, 2006 - 01:32

yes, I am getting the exact same errors as you, I wonder what's wrong...

#11

drewish - May 24, 2006 - 05:30

hey cheif, those questions go for you as well...

#12

jeforma - May 24, 2006 - 17:07

Ok, here are the errors that this gave me when I tried to upload another song.

This is the error that it gives me no matter if I preview or submit:

    * The selected file /tmp/tmp_LNPf9m could not be uploaded, because the destination /tmp/audio/Audio Adrenaline - Starting Over.mp3 is not properly configured.
    * The following errors where encountered while reading the file's ID3 tags:
          o Could not open file ""
    * Artist field is required.
    * Title field is required.

These are the three errors I get everytime I try to upload a song in my admin logs:

Message The directory /tmp/audio is not writable, because it does not have the correct permissions set.
Severity error

Message The directory /tmp/audio is not writable, because it does not have the correct permissions set.
Severity error

Message The selected file /tmp/tmp_LNPf9m could not not be uploaded, because the destination /tmp/audio/Audio Adrenaline - Starting Over.mp3 could not be found, or because its permissions do not allow the file to be written.
Severity error

and I do not have a tmp directory, well not that i see in my ftp, if I create one it will not do anything, if I change it, it will also not do anything...

Thanks for your time :)

Charles

#13

lectric - May 24, 2006 - 23:44

I thought I posted my fix for this. I changed the Temporary directory in Drupal/admin/settings/file system to "files" and the problem simply disappeared. I think some hosting environments don't like it if you are using a tmp directory inside public html for this, or trying to name another directory tmp. "I should point out that "don't like" is NOT a technical term and is in no way meant to explain the problem. It just seems that way to me.

I should also point out that Site5.com has clearly changed something about their environment becasue the module now works out of the box. The tmp/audio directory is created without any trouble. Somebody fixed something on my server and din't own up to it.

#14

jeforma - May 25, 2006 - 15:08

Yes, thank you very much, that fixed it my friend. :)

This should be pointed out in the README file drewish, it works after this, I am just getting some ID3 tag errors, but I am assuming that this is normal.

Thanks for all your time ;)

Charles

#15

d.b.s - June 5, 2006 - 01:16

I had a similar problem, and took hours to try to figure it out. Changing the temp directory to files didn't work. Changing files permision to 777 didn't work either. I kept getting the same error, unable to upload because the destination is not properly configured, where destination was actually only the name of the file, not including a full path to it. Looking at the error log, it was trying to write in root. ("The directory . is not writable").
I'm posting my solution here, in case anybody else has the same problem.
What solved it for me was to change the administer / settings / file system settings / File system path from files to /full-unix-path-to-drupal/files. Same for Temporary Directory.
Now, why I have to do this, I don't know. If anybody could help me understand it I would appreciate it.
Cheers.

#16

drewish - August 6, 2006 - 21:15
Status:active» fixed

with no additional feedback i'm going to assume you got this working. feel free to reopen if that's not the case.

#17

Anonymous - August 20, 2006 - 21:16
Status:fixed» closed

#18

patrickgmj - September 4, 2006 - 22:18
Version:<none>» 4.7.x-1.x-dev
Category:support request» bug report
Priority:normal» minor
Status:closed» fixed

Forgive me if I'm adding this is in the wrong place--I'm new to PHP and to Drupal...

The above solution worked great for me, except it broke images already on my site because it gave a different file path. I worked around it with the following cheesy hack on audio.module, line 546 ff., hardcoding in the full path as d.b.s. did:

//original code
//    $node->audio_file = file_save_upload($file, $temppath .'/'. $file->filename, FILE_EXISTS_REPLACE);
//end original code

    $node->audio_file = file_save_upload($file,'/home/patrickg/public_html/devel/DrupalDemo/files/'. $file->filename, FILE_EXISTS_REPLACE);

If my PHP skills were better I'd try to give more, but I hope this helps someone out there.

#19

Anonymous - September 18, 2006 - 22:30
Status:fixed» closed

#20

asterix - February 3, 2007 - 17:02

I experienced this same problem with acid free photo galleries when transferring to a new site. I ended up having to uninstall the modules image, filemanager, and acidfree, and delete their corresponding DB tables. After reinstalling I reconfigured permissions and everything works fine.

Alex
----------
Contract Web Development

#21

Baker - November 16, 2007 - 07:44
Version:4.7.x-1.x-dev» 5.x-1.3

Just to reiterate for those like myself that skip to the bottom of these to get to the solution the quickest...

If you're receiving this error with 5.x, you want to go to Home > Administer > Site Configuration > File System and modify the Temporary File Directory field to reflect the correct location of a directory that Drupal can write to. Mine was set to /tmp which not only didn't exist, but I believe the slash in front would have messed with it even if it did exist. I changed mine to files/tmp and everything works fine.

Thanks for the great advice from all of the above contributors. I just wanted to put a cap on things for the terminally impatient like myself.

#22

poseidon123 - January 3, 2008 - 15:50

Guys my problem is NOT related to audio module but I am getting EXACT same error. I am uploading images but not able to see them. I have just changed my host and it seems the problem is caused because of changing the hosts.

I tried all the combinations of Home > Administer > Site Configuration > File System in my 5.3 but it is still not working!

I don't get any error as well, it is just that the image don't gets shown! What might be the problem ?

#23

jmcclare - January 7, 2008 - 15:36

I have some more information on why this issue happens (it just happened to a site I work on).

I found that Drupal was leaving tmp_* files in the /tmp directory. This may be caused by users uploading a file and cancelling the node edit form, or errors or timeouts after the file was uploaded and saved as a tmp_* file. It seems that you get an error when you upload a file and the tmp_ file Drupal tries to create for it already exists.

I deleted all of these old tmp_ files from the /tmp directory and Drupal was once again able to upload and save the files we were having problems with.

Drupal should clean out these old files during cron runs, but in lieu of that I have setup a simple cron job to run every morning at 5:00am and delete any of them that are older than one week: 0 5 * * * find /tmp -name "tmp_*" -type f -mtime +7 -exec rm {} \;

#24

cindyr - April 17, 2008 - 18:40

For anyone who has read through all this and still gets the "because the destination is not properly configured" error, let me point out that you need correct file permissions set not only here: Home > Administer > Site Configuration > File System but also under the module settings. E.g., in my case, Node Images.

#25

drewish - April 18, 2008 - 05:51

check if your host has open basedir restrictions that might be preventing access to the directory.

#26

Andrew_Mallis - May 28, 2008 - 04:02

The problem is most likely related to file ownership rather than persmissions. If you are running Apache as the user apache, chown your files directory to apache:apache.

#27

mennonot - November 20, 2008 - 20:50

I ran across this problem with the FileField module. After trying nearly evrey solution suggested above unsuccessfully, changing the user using chown (as suggested by Andrew_Mallis) finally worked. I also chowned the directory created by the File Field module the file field settings (i.e. files/filefield).

I suspect (but cannot prove) that this error message may sometimes be misleading because it points to the tmp directory (or whatever is set in the file system settings) when the directory the file is being moved to (usually created by the module) is the one at fault.

#28

Blackstorm - November 24, 2008 - 12:24
Status:closed» postponed (maintainer needs more info)

Sorry for the reopening of this, but I've some serious trouble in using the file upload. The error is the same, but for some reason i cannot unset the read-only attribute on windows wamp folder. I've read saomething about, it seem tha tha apps mostly ignore the read-only attrib for the folder. How can I resolve this prob?

#29

joehudson - December 15, 2008 - 15:05

In D6 if the directory you want to move a file too is not in your 'files' path set in your site config you can't use the api functions: file_move, file_copy or file_save_upload because they all call file_create_path, which requires that the file destination is in the site 'files' path. So, if you want your module to use a different directory, store it using say variable_set('mymodule_files', path) and basically copy the api functions into into mymodule_file_move() ... etc. but remove the call to file_create_path and replace with a check for your modules file path (don't just allow any old path, it's asking for trouble!), and call those functions instead. Hope that helps :)

#30

berenddeboer - April 21, 2009 - 14:07

Another solution: I used a custom module which called file_save_data(), but the target was outside the Drupal directory which appears to be forbidden.

#31

cjsolvesit - July 20, 2009 - 02:24
Version:5.x-1.3» 6.x-1.x-dev

I an using version 6.x. I had every problem on this list and I finally got it to work. My situation was images but it was a problem with the file system configuration:

1) There was a conflict with the Pathauto module. After I disabled Pathauto it worked!

2) On my install on a shared server, /tmp is actually /home/greatbas/tmp. put "/home/greatbas/tmp" in the "Temporary Directory" field on admin/settings/file-system.

3) I am using a multisite configuration. in admin/settings/file-system the "File System Path" starts at the server public_html/ directory. Enter "sites/greatbassguitars.com/files" in this field to access the "files" directory in your home directory.

I hope that this can save someone else about 4 hours!

#32

JerryH - August 18, 2009 - 19:39

Same issue here, also none of the tokens are being replaced !!

Though we can't turn pathauto off.

 
 

Drupal is a registered trademark of Dries Buytaert.