dear all

I've installed Drupal 4.7.3 on my site, with upload module enabled. I've set the admin->settings->access control, admin->settings->upload. But after I uploaded the attachment and click submit, the attachement doesn't appear in the Page. What is the problem?

I've set the file system setting pionted to "files", temp file folder to "temp", download method is public. I've tested the files folder by put a file under /drupal/files manually and access via http:www.site.com/drupal/files/filename succeeds.

Thanks anyone give me help!!!

Comments

gollyg’s picture

could be an access issue - you obviously have read permissions, but what about write permissions?

grassdog’s picture

there is a .htaccess file under the /drupal/files folder, is that for the permission?

Thanks.

gollyg’s picture

no, you need to do it at the operating system level. http://drupal.org/node/68746 might help.

grassdog’s picture

So there should be other problems.

grassdog’s picture

The problem is for the temporary directory setting under admin->settings->file settings.
Previously, I set it to a relative directory to the drupal installation, and drupal reports no error, but the upload does not work. After I change it to a absolute directory, in the form "d:\users\drupal\temp", the upload works OK.

I think this may be a bug in the drupal core for file upload:
1. it does not correctly translate the relative path.
2. if the user does not have enough permission of the temp directory, no warning or hint is displayed. The file attachment just disappears.

I think I might report it as a bug.

gollyg’s picture

possibly a bug, but that is a pretty heavily used module, so it is probably unilkely. If no error messsage is being displayed that is more of a problem. But in my experience an error message will display for path errors (although they may be limited to 'directory does not exist').

Alternatively, since this is only happening for relative directories, it could be relating to settings.php (base_url setting) or htaccess (redirect setting)?

grassdog’s picture

My root folder is at d:\users\site.com\drupal
If I set the temp directory to c:\windows\temp, no error is reported either and the upload does not work. If I set c:\windows\tempa, an error is reported. So I suppose c:\windows\temp exists but I have not permission.

Thus I think the error has two side:
1. folder permission is not checked correctly, like c:\windows\temp.
2. relative path is not correctly interprated. Because temp should be equal to d:\users\site.com\drupal\temp, but the absolute path works while the relative path fails .

Because the phenomena of temp and c:\windows\temp are the same, I guess temp is interpated as some existing directory which I have not permission.

I've reported this as a bug. While reporting this bug, I also found some other bugs for the bug reporting system:)

If you are interested, I can reproduce this error on my site for you:)

Thank you very much for your help!

grassdog’s picture

I am sure it's a bug:)

gollyg’s picture

you did check the base_url in the settings.php file? Was it set to a path or the server address (eg c:/www.drupal or http://www.localhost/drupal)?

I still think that this may have something to do with it :)

grassdog’s picture

Maybe there some wrong with my configuration, anyway, I am a newbie to drupal.

However, consider the following observation:

if I create a folder temp under drupal_root, then set temp dir to tempxxx, an error message will be shown.
If I set temp dir to temp, but without correct permission, also a warning will occur.

I can provide the accout of my site, then u can help me check it out:-) my mail is lijun.xing@td-tech.com

LeoB-1’s picture

I could not upload attachments either. I noticed that the temporary directory in Settings - File System Settings was "/tmp". I changed that to "files/tmp" and created that directory with permissions 775. After that it worked to upload attachements.

I do not know if this is correct file permissions. I do not know if I have to do some security changes in .htaccess in files/tmp (there is currently no .htaccess there). So if someone with the needed knowledge will step in I would be glad. ;-)

ljet’s picture

I tried to change the path name but still has an error.
There is no error message display but cannot upload it.
I'm using drupal 4.7.5 with php 5.2 and apache server 2.0.58 in UNIX O/S.

derektut’s picture

Hey everybody. I keep getting this permission denied error (below) every time I attempt to upload an image. Have scoured via Google and rechecked my permissions ad nauseum. The following users have full control of the files in my website root directory, which is running on IIS 6.0. I also have an htaccess file in the files folder.

IIS_WPG (mydomain\IIS_WPG)
Internet Guest Account (mydomain\IUSR_mydomain)

Here is my error:
warning: copy(c:\Inetpub\wwwroot\files) [function.copy]: failed to open stream: Permission denied in c:\Inetpub\wwwroot\includes\file.inc on line 374.

The selected file c:\Inetpub\wwwroot\files could not be copied.

Here is line 374 from File.inc
if (!@copy($source, $dest)) {
drupal_set_message(t('The selected file %file could not be copied.', array('%file' => theme('placeholder', $source))), 'error');
return 0;
}

This is really puzzling, as all of the permissions appear to be correct. Am very much appreciative of any help. Thank you in advance.

grassdog’s picture

you may check the permission and try some other configuration. I think only grant every one full access is not enough, u may check the right for ur current account.

derektut’s picture

What do you mean by "current account"? If I understand you correctly, I am logged in on the server as an administrator (all administrators have modify permissions), which would be my "current" account, no? By the way, the same exact permission denied error also occurs when I access the site from another computer entirely, so it doesn't appear to be related to the user that is executing the 'copy' command via the script.

grassdog’s picture

it is the iis server task that accesses the folder, so even u access ur site from another computer, the user is the same.

besided, check the folder permission in iis manager.

derektut’s picture

Thanks for the advice. I needed to just add permissions to a user (actually, I had to add the user itself and then add permissions). Now i can upload file attachments.

However, now I am getting the following error in my image upload settings:

warning: mkdir() [function.mkdir]: File exists in c:\Inetpub\wwwroot\includes\file.inc on line 91.
The directory does not exist.
The settings have not been saved because of the errors.

Must be related. Will have to dig around in the permissions some more.

derektut’s picture

that every time I go to image settings (when I get the error), the path is already set to an incorrect value ("c:\inetpub\wwwwroot\files\images"). It should actually just be "images", but it won't let me get rid of that default value. i have tried uninstalling the module (even deleting the module folder) and reinstalling, but it still brings in that incorrect default value. How can i get rid of it?

grassdog’s picture

u have to dig around. Mine is OK, but I have changed many settings, so I don't know which one is the root cause.
ur problem may be related to the files setting in administer->settings->file settings.

Keybern’s picture

so what's the exact solution in all this?
Should I create a new user on the server and grant him to the temp and files-folders ? I don't now how I could do that, and if I'm allowed to do that in the first place...
Please help, because this is not a minor issue anymore

Joe One’s picture

Hi Keybern,

I'm experience EXACTLY the same problem on my site which is hosted on a IIS 6.1 server.
Do you have any luck finding a solution?

I've looked into the files.inc script and i found out that when you do an upload of a file this function ( file_copy ) returns this error message when you do a check on the $source variable.

if(!is_object($source)){
drupal_set_message(t('Source is no object!'), 'error');
}

returns true, so the function isn't getting any "source" ... !

RobRoy’s picture

I've posted a patch for Drupal 4.7 at http://drupal.org/node/91624 which may relate to this bug on Windows when magic_quotes_gpc is left On. Please review it if you can.

--
Rob
Founder and Director
Electronic Insight Corporation

Recent Drupal Projects: MP3PIG | MySpace Layouts

animago’s picture

I am a new user, not experienced with this troubles and I have to learn a lot of basic things.

So what shell I do with your patch? Where do I place it?

Anonymous’s picture

jefbak2’s picture

I have tried installing drupal on my Netfirms hosted server twice now and have had no luck with uploading files either. I am not sure if Netfirms allows world writeable but I see that the garland theme wrote to the /files directory sucessfully. But when I try to attach a file it looks like it worked but then nothing shows up in the /files directory.

Other times I get this error: illegal name for ftp root directory

I'm not sure if I can even get to my php.ini file on the netfirms server...

I have tired both public and private write settings in Drupal:
Drupal 5.1
Database schema Up to date
File system Writable (public download method)
GD library bundled (2.0.28 compatible)
MySQL database 5.0.24a
PHP 4.3.10
Web server Apache/1.3.34 (Unix) mod_fastcgi/2.4.2 mod_perl/1.26

Am I hosed?

rlnorthcutt’s picture

I have a fresh install of 5.1 with Siteground, and I'm having the same trouble - the uploads are not taking. The folder names are correct, permissions are 777, and all of the settings in Admin are correct. When I attach a file, is says it is good, but when I try to attach a second file, it simply replaces the first. Also - if I just attach a single file and save/preview, the attachment is never there.

I have tried checking the tmp folder before submitting, and I dont see any files. However, manually saving files to "tmp" or "files" folders works, and I can view them online.

I didn't have this trouble with 4.7, and I have seen several posts with people having the same trouble, but no solutions yet... Help?

regards,
Ron Northcutt
Directory of Technical Marketing, Acquia

chrishathaway’s picture

According to http://drupal.org/node/121467, turning your favicon back on fixes the problem.

I had the same issue as you guys with 5.1, and when I turned the favicon on for the theme, it started working again.

Chris Hathaway

rlnorthcutt’s picture

Chris - this worked for me... a bit weird, but whatever!

thanks again

regards,
Ron Northcutt
Directory of Technical Marketing, Acquia

jefbak2’s picture

I didn't know why my site uploads were suddenly working, but now that make sense. Thanks!

kus’s picture

subscribing to thread. same problem here with a fresh install 5.1, rights permissions and path are fine.

firefox 2.0.0.3 / ubuntu
firefox 2.0.0.3 / windows

it only saves the files when i do not press the attach button and directly press save.

kus’s picture

my problem is solved. with garland/minelli if i activate the favicon, the path to the favicon is not set correct and produces non valid html and breaks the upload.

ceo3141’s picture

I am having the same problem with the Upload module in Drupal 5. I had it working, and now it is not. I went back to the Blue Marine theme, I have File settings set to:
File system path:
files
Temporary directory:
/usr/tmp
As I said, I had it working, I feel as if I am missing something obvious . . . I have the user set to permission uploads, have file size 1MB.
Does anyone have any ideas? Thanks!

hbrabant’s picture

With release 5/Windows, I have the same problem (when I upload a file. there is no error message and no attached file is displayed). Solved with c:\temp -> c:/temp, in "file system", "temporary files".

Nikkol’s picture

Same here. It was the temp directory setting that was my problem. Fixed with the appropriate full path to a known directory with correct permissions.

drupaldooer’s picture

i have Drupal 5 installed and currently i have no errors, but the file just isn't showing up.

in my config > file system, i currently have:

full system path:
files

temp:
files/tmp

public.

i've tried changing them to the full path: /home/domain/www/files & /home/domain/www/files/tmp

for my full path, but i still experience the same issue after doing this...

i've checked all my permissions, and everything is fine. I've also tried enabling the default favicon image... still no luck. any ideas?

Nikkol’s picture

try using a full filesystem path like c:\temp

drupaldooer’s picture

"i've tried changing them to the full path: /home/domain/www/files & /home/domain/www/files/tmp

for my full path, but i still experience the same issue after doing this..."

im not on a windows server... ^thats my full path

Nikkol’s picture

what are the permissions you set on files/tmp? 775?

btw .. i have one installation of Drupal on linux and I have /tmp for the temporary directory (which is outside the webroot). The permissions on that folder are 755.

drupaldooer’s picture

Files = 777
Files/tmp = 777

as far as the tmp folder goes, outside of the webroot, I have one as well, however, I don't think that that folder is being used? but that permission is set to 1776. (this is at url/tmp, rather than url/home/user/www/files/tmp)

holbech’s picture

My upload seemed to work fine (no errors or warnings), but didn't upload anything. I changed my temp directory to the full path and know i works..

echo getcwd()."/files/tmp";

was the path

(and btw, the preliminary version of timeline seems to confilct with the upload modules JS, so I needed to disable that)

scafmac’s picture

So I was having a similar problem - no uploads, no errors, Drupal 5.5. It only seemed to happen on a new web host. I'm not sure if it is a factor, but they run php as a cgi, which is different than the normal lamp configuration. Anyhow, instead of using the server wide /tmp directory which I do have write permission to, I finally created a local tmp folder in the files directory. I gave it the proper perms (775 or 2775) & changed the setting on the admin page - voila - it worked.

Hope that helps someone.

markdionne’s picture

The remember_me module has a bug that can cause upload to fail, among other things. See:
http://drupal.org/node/141418
-mark

veeaa’s picture

Thank you, markdionne!

I had the same symptom: suddendly, upload stopped working (well, after switching on the remember_me module, I guess). People have not mentioned, what modules they use. I had the following modules on in 4.7.3:attachment, filemanager and upload. I do not know, if I really need/use them all. In addition, I have the following modules, which might have something to do with upload: image, imce, image-attach and img-assist. I have all those off: they just do not work. I upload images with ftp and write the nodes with Word, which I paste into TinyMCE as HTML. This is the only working solution with Drupal and images I have found so far. The HTML is awful, ofcourse.