Trying to follow the directions at http://docapi-demo.deviantsolutions.net/node/1 to upload a jpg.

I'm trying to upload http://drupal.org/files/soc08-198x128_white.jpg at node/add/doc and once submitted I get a WSOD.

Comments

bradfordcp’s picture

I have uploaded the image to both my demo dev site without any issues. Where dd you try to upload it? Is there anything in your error log?

Thanks!

bradfordcp’s picture

Version: 6.x-2.x-dev » 6.x-2.0-alpha1
Assigned: Unassigned » bradfordcp
Status: Active » Postponed (maintainer needs more info)
agentrickard’s picture

I never got a WSOD either, which is weird. I had some other errors that were based on some UNIX permissions that I had to adjust, but no WSOD.

webchick’s picture

I'm on localhost. It's a MAMP install.

When I tried it in Safari, I got:
Safari can’t open the page.
Safari can’t open the page “http://localhost/soc6x/node/add/doc”. The error was: “Operation could not be completed. (kCFErrorDomainCFNetwork error 302.)” (kCFErrorDomainCFNetwork:302) Please choose Report Bugs to Apple from the Safari menu, note the error number, and describe what you did before you saw this message.

My guess is it's something to do with #280112: Errors when enabling the module.

agentrickard’s picture

cpbradford and I had a long look at this in IRC.

Very likely. There is also a weird (core bug) issue with the use of hook_enable().

If you enable both the core DocAPI module and the plugin at the same time, Drupal executes the plugin enable hook _first_ before the main module is active, so the implementation of hook_enable() fails to register the plugin.

I had to enable the DocAPI module, and then enable the plugin.

I call this a core bug because modules with dependencies should not be installed before the module they depend on. I think the issue is in module_enable().

webchick’s picture

Title: WSOD when uploading jpeg. » Create docapi_library directory

Ah, I did indeed enable both at once. But even when enabling one first and then the other, it still fails.

I get two of these in watchdog after:

move_uploaded_file(/Applications/MAMP/htdocs/soc6x/sites/default/files/docapi_library/soc08-198x128_white.jpg) [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/soc6x/sites/all/modules/docapi/docapi.module on line 312.

The directory docapi_library indeed doesn't exist. The files directory is writable, however. So I'm guessing on hook_enable/hook_install ought to create this directory for me, or... something.

agentrickard’s picture

Status: Postponed (maintainer needs more info) » Active

Yup.

@bradfordcp

For reference, here is a similar function used in the MySite module. It tries to create an upload directory:

http://therickards.com/api/function/mysite_icon_folder_check/MySite

$path here is defined as:

$path = file_create_path(file_directory_path() .'/'. $folder); 

In your case, $folder == 'docapi_library' on initialization, and might be changed by the user later.

You can run this routine on docapi_enable(). I would run it again on the DocAPI configuration page, and return an error if there is a problem.