Steps to reproduce:

  1. Add a File field to the page node type.
  2. Go to upload a file... boom!
  3. Warning: filesize() [function.filesize]: stat failed for public://readme.txt in file_save() (line 575 of /Applications/MAMP/htdocs/drupal/includes/file.inc).
    

The real problem:
Somehow I accidentally made a directory called public: in my root Drupal installation. (Actually, I think it was filefield_paths that did it...)

Then in the file upload process, the file gets moved to /path/to/drupal/public:/readme.txt instead of public://readme.txt, and this breaks everything.

There's no bug to fix here, AFAIK -- I'm just documenting this in case anybody else stumbles into it.

CommentFileSizeAuthor
#5 Auswahl_008.png83.08 KBHelrunar
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gmak’s picture

I've got the same problem. Any help in finding a fix would be really helpful. I'd hate to have to rebuild in order to get rid of this issue.

gmak’s picture

I just found that if you delete the 'public:' directory things work fine

bfroehle’s picture

gmak: Thanks for beating me to the punchline! Yes, removing the public: directory is all that is needed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Helrunar’s picture

Version: 7.x-dev » 7.2
Category: support » bug
Priority: Normal » Critical
Status: Closed (fixed) » Active
FileSize
83.08 KB

Hi all, i've got the same Problem with Drupal 7.2. I set up an imagefield and all work fine. Then i save my Node...
When i will create a new Node, or editing an existing, i have to delete the folder public:, but on the next save, the folder is generated again, so: same procedure again and again and again.... and this for every Node i want to generate.

catch’s picture

Status: Active » Postponed (maintainer needs more info)

@ Helrunar: are you using filefield_paths module? If so you should check the issue queue for that module.

If you're not using filefield_paths, please list which contrib modules are in use.

Helrunar’s picture

Status: Postponed (maintainer needs more info) » Fixed

@catch

you are right. I've used filefield_paths, have now deaktivate it and all work fine.

jim005’s picture

Thanks ! Same issue.... don't know how this directory has been created, but simply deleted and it's back to normal !

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mmoralessc’s picture

i'm getting this me too:
Warning: fileowner() [function.fileowner]: stat failed for temporary://update_tSbRYF in update_manager_local_transfers_allowed() (line 906 of /home1/allabpc2/public_html/site2/modules/update/update.manager.inc).

I'm totally new to Drupal and not an expert at all building websites... this is actually my first one....

I installed Drupal 7 from simple scripts at Hostmonster.com for the first section, it is done and completed. I didnt have any problem working on it.

Now that I'm trying to work on the second section I installed another Drupal & from simple scripts and is giving me a lot of error messages like:
" Warning: fileowner() [function.fileowner]: stat failed for temporary://update_FXjEyi in update_manager_local_transfers_allowed() (line 906 of /home1/allabpc2/public_html/site2/modules/update/update.manager.inc).
Warning: move_uploaded_file(temporary://drupalallaboutsetember.zip) [function.move-uploaded-file]: failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in drupal_move_uploaded_file() (line 1598 of /home1/allabpc2/public_html/site2/includes/file.inc).
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/var/tmp/phpnRGCNj' to 'temporary://drupalallaboutsetember.zip' in drupal_move_uploaded_file() (line 1598 of /home1/allabpc2/public_html/site2/includes/file.inc).
File upload error. Could not move uploaded file.
Warning: fileowner() [function.fileowner]: stat failed for temporary://update_BqIXPC in update_manager_local_transfers_allowed() (line 906 of /home1/allabpc2/public_html/site2/modules/update/update.manager.inc)."

I not able to upload any theme or modules ( the same that I used for the first section)
I made sure to install the Drupal & in a diferent location :

and also I made sure to create a new database.
But still I'm not able to work on it and is making me loose time.
It is the third time I try....
Can you please help me to fix this. I was reading some of yhe post above and you mentioned something about deleting the "Public directory", where and how can I do that
Like I said ... I'm totally new to this.

thanks in advance for your help!
Thanks in advance.

mmoralessc’s picture

how do you delete the directory?

mmoralessc’s picture

what directory did u delete?

mmoralessc’s picture

i'm not sure wich one is the one I need to delete.:
I have ;
public_ftp & public_html
Can someone tell me which one is the one i need to delete?
please help!

silkogelman’s picture

@mmoralessc you probably never want to delete the public_html directory, as it will probably delete your entire site.
The 'public:' directory that is discussed in this issue is a different thing.

I stumbled upon this issue too in this case:
Drupal 7.8
Image field multiple images (unlimited)
filefield_paths latest dev (2011-Jul-26)
Before installing filefield_paths I did not have this issue with the Image field with multiple images.

The same issue at filefield_paths:
#1051736: Unable to upload files: writing to "~/public_html/public:" and "~/public_html/private:"

drzraf’s picture

Version: 7.2 » 7.x-dev
Priority: Critical » Normal
Status: Closed (fixed) » Active

I'm reopening because I noticed the following :

1) file_save() does not check the filename value thus it *may* be NULL (say eg, programmer error)
2) in such case, filesize(public://...) will fail even if the file effectively exists at this location.

I think that either
1) file_save() should check the value of "filename"
or
2) filesize() (= the stream wrapper which handles public:// URL) should succeed if the "uri" is valid even if "filename" is NULL.

bfroehle’s picture

Status: Active » Closed (fixed)

drzraf: What you describe is unrelated to this issue. Please do not reopen closed issues with new topics of discussion. Instead please create a new issue.

damic’s picture

Priority: Normal » Major
Status: Closed (fixed) » Active

Hello,

Sorry for re opening but I have exactly the same problem and none of your solutions works for me. I tried:

- Disable fields_path
- remove public directory
- check folders permissions
- check drupal file system settings

I still can't upload -> Warning: filesize()

I'm running Drupal core 7.9.

Thanks for your help.

catch’s picture

Category: bug » support
Priority: Major » Normal
Status: Active » Closed (fixed)

@damouille, see bfroehle's post - if please open a new bug report with clear steps to reproduce the bug report, rather than re-opening this one.