Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Steps to reproduce:
- Add a File field to the page node type.
- Go to upload a file... boom!
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.
Comment | File | Size | Author |
---|---|---|---|
#5 | Auswahl_008.png | 83.08 KB | Helrunar |
Comments
Comment #1
gmak CreditAttribution: gmak commentedI'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.
Comment #2
gmak CreditAttribution: gmak commentedI just found that if you delete the 'public:' directory things work fine
Comment #3
bfroehle CreditAttribution: bfroehle commentedgmak: Thanks for beating me to the punchline! Yes, removing the
public:
directory is all that is needed.Comment #5
Helrunar CreditAttribution: Helrunar commentedHi 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.
Comment #6
catch@ 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.
Comment #7
Helrunar CreditAttribution: Helrunar commented@catch
you are right. I've used filefield_paths, have now deaktivate it and all work fine.
Comment #8
jim005 CreditAttribution: jim005 commentedThanks ! Same issue.... don't know how this directory has been created, but simply deleted and it's back to normal !
Comment #10
mmoralessc CreditAttribution: mmoralessc commentedi'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.
Comment #11
mmoralessc CreditAttribution: mmoralessc commentedhow do you delete the directory?
Comment #12
mmoralessc CreditAttribution: mmoralessc commentedwhat directory did u delete?
Comment #13
mmoralessc CreditAttribution: mmoralessc commentedi'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!
Comment #14
silkogelman CreditAttribution: silkogelman commented@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:"
Comment #15
drzraf CreditAttribution: drzraf commentedI'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.
Comment #16
bfroehle CreditAttribution: bfroehle commenteddrzraf: 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.
Comment #17
damic CreditAttribution: damic commentedHello,
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.
Comment #18
catch@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.