Uploaded files not found

Uploaded files not found

by Tyler Gilpin -
Number of replies: 18

I have a major problem when creating databases in the database activity module. I can create the database just fine, but when I try to upload a file to the database after I've created it from a template. It says the entry was sucessful. However, when i try to download I get "Sorry, the requested file could not be found". I'm using ubuntu 10.04 with moodle 1.9.19 and I have the create permissions on the data folder (chmod 777). I can successfully upload other files just fine on other activities, just not this activity. The database activity is creating the entry in the moodle database, but it won't create the data folder within the moddata folder in the moodle data directory.

Anyone know what's going on?

Average of ratings: -
In reply to Tyler Gilpin

Re: Uploaded files not found

by Tyler Gilpin -

Anyone? sad

In reply to Tyler Gilpin

Re: Uploaded files not found

by Itamar Tzadok -

I've just tested on WAMP 1.9.19+ and seems to be no probelm uploding and downloading from the Database activity.

What do you mean by "created from template", preset?

Have you tried creating a simple activity with one file field, and then upload download?

smile

In reply to Itamar Tzadok

Re: Uploaded files not found

by Tyler Gilpin -

Hello Itamar,

I don't have an issue on my other separate moodle site and both are the same version (1.9.19+ 20120726). The only modified file in the database activity mod folder is the view.php file and both sites have this file. Otherwise everything else is the same.

This error happens with or without a preset. It does not matter. I can create a simple upload field and it says that it has been uploaded. But when click the link to download, it does not download (give error - attached image).

I did create a simple activity. Everything runs like it should but the uploading/downloading part. It doesn't make sense to me. Take a look at the screenshots I've made using the link below.

http://co.jessamine.kyschools.us/downloads/

In reply to Tyler Gilpin

Re: Uploaded files not found

by Robert Brenstein -
Activate the debug mode and see whether any errors are logged.
In reply to Robert Brenstein

Re: Uploaded files not found

by Tyler Gilpin -

I get a few errors. Attached is the log. The log will show from when I created the database, uploaded the file and tried to view it. Below is what moodle debug displays on the website.

  • line 5889 of lib/weblib.php: call to debugging()
  • line 199 of file.php: call to print_error()
  • line 186 of file.php: call to not_found()

Thanks,
Tyler

In reply to Tyler Gilpin

Re: Uploaded files not found

by Robert Brenstein -
The log you attached shows an error in some library function when viewing database records and a number of images missing in your theme, so no php-level errors related to your database files. You say you checked permission of the data folder. Have you also checked owner and group? Have you tried to create a database instance by hand adding only the file field and checking whether that works?
In reply to Robert Brenstein

Re: Uploaded files not found

by Tyler Gilpin -

I really didn't think I had to check the owner and group. I didn't do this on my other moodle server and it has the same server specs and moodle version. The database activity works fine on that one. However, I'll check the owner and group and see what it has on the working server.

Yes, I've created different instances and I even created a new course with a new database activity and still nothing works.

In reply to Tyler Gilpin

Re: Uploaded files not found

by Tyler Gilpin -

Hi Robert, 

I compared both server owner and group settings. Looks like they both have the same permissions. The data folders are set to 750 and the www root is set to 755. I don't think it's a permissions or owner/group issue. Also, both have the same php settings and the tmp directory has the correct permissions (i think). Could it be database related?

working server - 

Non-working server - 

tmp permissions on both servers - 

Thanks,

Tyler

In reply to Tyler Gilpin

Re: Uploaded files not found

by Robert Brenstein -
is the folder shows above for non-working server the same folder as for working? working seems to be the main moodledata folder not a folder of the database activity for a specific course.
In reply to Robert Brenstein

Re: Uploaded files not found

by Tyler Gilpin -

Hi Robert,

No, these are two separate servers with separate data folders. The folders shown are the main data folders for that specific moodle server. Also, when I set permissions to these main data folders I did it with recursive, so every folder within the main data folders should have the same permissions (chmod 750) as the root folder (main data). Below are the permissions within the main data folder for each course on the working server. These are the same permissions on the non-working server as well.

working server-- 

Working server moddata folder permissions-- 

Thanks,
Tyler

In reply to Tyler Gilpin

Re: Uploaded files not found

by Robert Brenstein -
Just out of curiosity, go down to specific course folders and further down to data folders (where database keeps files) and check whether the files are there or not. That may give a clue whether the problem is with upload or download. The latter could be causes by users having different capabilities assigned to their roles on different servers. Also, have you tried to reinstall just the database module on the prblem server? May be some file is corrupted. Yes, I know, i am drawing straws.
In reply to Robert Brenstein

Re: Uploaded files not found

by Tyler Gilpin -

This varies. If the database and it's entries already exist, the download links to those files work fine. However, if I try to add another entry to that database it will add/save and even link the file, but the linked file is broken. When I go to that specfic course data folder and then the database files folder, I notice that it didn't create the folder and upload the file I attached to the entry.

No, I did not try to reinstall the database module. I'm afraid that it will delete everything related to that module (files, entries, etc). I could try a test server but that will take some time. I just dont understand why it doesn't work on this server and work on a totally different server. They're the same version of moodle. I even upgraded to the latest build and nothing changed.

Thanks,

Tyler

In reply to Tyler Gilpin

Re: Uploaded files not found

by Robert Brenstein -
You can replace the module folder in the mod folder with the software without a fear of loosing anything in any activity.The only point of this exercise is to make sure that no files are corrupted.

I find it really strange that uploads fail for this module but work for any other module and NOTHING is shown and/or logged as error. As far as I know, all uploading is done by the same code, called internally by all modules.
In reply to Robert Brenstein

Re: Uploaded files not found

by Tyler Gilpin -

I replaced the current database module folder with a fresh copy and it didn't change anything. However, I found something interesting. I looked at the moodle log entries and below is what I found when uploading a doc.

Moodle log -  

Moodle php config - 

If moodle is trying to upload to that path, then no wonder it doesn't create the folder in the main data root directory. The real question is, why is it going to that path? My moodle config shows that I have the correct data path.

Thanks,

Tyler

In reply to Tyler Gilpin

Re: Uploaded files not found

by Robert Brenstein -
I just checked log entries for Moodle 1.9 on my server and for your
ddata/data/387/8233/26764/12-13DistrictCalendar.pdf

I see
2/moddata/data/1/28/125/Screen_shot_2012-09-29_at_23.59.56_.png

so it seems you are missing 'course#/mo' in the path: ddata should be moddata, a name of folder where modules keep their data, and preceeded by course id. Something is eating a part of the path. Really curious.

If nobody can answer that here, you might want to post a question about this in the developers forum (with a link to this discussion), although the fact that this works for other modules but fails only for database still could point a finger at a problem with the data module. Makes me wonder if there were any changes to that version of database module lately.
In reply to Robert Brenstein

Re: Uploaded files not found

by Tyler Gilpin -

Thanks Robert.

Anyone else have ideas to why this doesn't work?

Thanks

Tyler

In reply to Tyler Gilpin

Re: Uploaded files not found

by Tyler Gilpin -

Can anyone else help me with this issue? mixed

Thanks,
Tyler

In reply to Tyler Gilpin

Re: Uploaded files not found

by Tyler Gilpin -

Finally figure out the problem a few weeks ago. For some reason the database activity doesn't like when you have a mount point on Linux called /data. I changed it to something different starting with /moodle..... and it worked.