Image (JPEG) filetype cannot be accepted.

Image (JPEG) filetype cannot be accepted.

by Joseph Rézeau -
Number of replies: 19
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi

In the course of testing MDLQA-2048 for Moodle 2.3 I have come across an unexplainable bug.

Step 3. says "Complete the form by typing some text into every box, including an image in each box which has a text editor, such as the question text."

So I tried to include images, but the file picker keeps telling me that images (JPEG, GIF) are "not accepted". This problem is not restricted to questions editing, of course, I am getting the same bug when trying to insert images in any Moodle 2.3 activity.

Joseph

Attachment 26-05-2012 14-28-33.jpg
Average of ratings: Useful (1)
In reply to Joseph Rézeau

Re: Image (JPEG) filetype cannot be accepted.

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Is this your own Moodle 2.3? I tried on the QA Moodle (if you mean this one http://tracker.moodle.org/browse/MDLQA-2048 ) and it worked ok - I was able to upload and view jpgs

In reply to Mary Cooch

Re: Image (JPEG) filetype cannot be accepted.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

this is my own moodle local test site

Moodle 2.3dev (Build: 20120525)

Windows 7 64bits

Same error message is displayed in Chrome 19.0.1084.52 m; MSIE 9 and Firefox 12.0 when trying to upload an image file from my computer in the file picker.

Joseph

In reply to Joseph Rézeau

Re: Image (JPEG) filetype cannot be accepted.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Update...

The problem seems to come from a change introduced in file <moodle>/repository/upload/lib.php in moodle 2.3dev (lines 172 and seq.) If I replace those lines in 2.3:

if ($this->mimetypes != '*') {
            // check filetype
            $filemimetype = file_storage::mimetype($_FILES[$elname]['tmp_name']);
            if (!in_array($filemimetype, $this->mimetypes)) {
                throw new moodle_exception('invalidfiletype', 'repository', '', get_mimetype_description(array('filename' => $_FILES[$elname]['name'])));
            }
        }

with the equivalent lines in moodle 2.2:

if ($this->mimetypes != '*') {
            // check filetype
            $filemimetype = mimeinfo('type', $_FILES[$elname]['name']);
            if (!in_array($filemimetype, $this->mimetypes)) {
                if ($sm->string_exists($filemimetype, 'mimetypes')) {
                    $filemimetype = get_string($filemimetype, 'mimetypes');
                }
                throw new moodle_exception('invalidfiletype', 'repository', '', $filemimetype);
            }
        }

everything works fine.

Weird,

Joseph

In reply to Joseph Rézeau

Re: Image (JPEG) filetype cannot be accepted.

by Tim Barker -

Joseph, this issue was raised and fixed last week, I have tested this on the latest build and it is no longer a bug. I do not get this error in the html editor fields.

What build are you on?

In reply to Tim Barker

Re: Image (JPEG) filetype cannot be accepted.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

@Tim,

I am on Moodle 2.3dev (Build: 20120525) and still getting this annoying bug. Can someone else confirmt that they have the bug?

Joseph

In reply to Joseph Rézeau

Ang: Re: Image (JPEG) filetype cannot be accepted.

by Bente Olsen -
Picture of Testers Picture of Translators

I just went through MDLQA-2048 on qa.moodle.net with Firefox 12. I could upload jpg's, but after saving I could not see them in the question preview. Then I opened the preview in Chromium18.0.1025.151 , where I could se the image placeholder.

In forum I could upload and see both a png, a gif and a jpg image.

In reply to Bente Olsen

Re: Ang: Re: Image (JPEG) filetype cannot be accepted.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Bente,

Yes, I've seen your comment in MDLQA-2048, but for me this is more serious, it's a total blocker since I cannot upload any image or media file. I've opened MDL-33391.

Joseph

In reply to Joseph Rézeau

Re: Ang: Re: Image (JPEG) filetype cannot be accepted.

by Lael ... -

I encountered the same issue with a download of the zip package on Monday. Tried uploading a file of jpg, png, and zip and got the same response. I was using the third party lightroom module to see if it worked with 2.3, but would assume the issue is the filepicker as per Joseph's experience. I can post build numbers etc tomorrow.

Lael

In reply to Joseph Rézeau

Re: Ang: Re: Image (JPEG) filetype cannot be accepted.

by Lael ... -

Moodle 2.3dev (Build: 20120525) is what I was using..

In reply to Lael ...

Re: Ang: Re: Image (JPEG) filetype cannot be accepted.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Yes, but... are you - like me - using a moodle site that is installed on Windows (and which Windows version?).

Joseph

In reply to Joseph Rézeau

Re: Ang: Re: Image (JPEG) filetype cannot be accepted.

by Lael ... -

Hi Joseph,

Yes I am - testing on server 2007. Sorry, I posted that on the tracker, but not on this thread.

Lael

In reply to Joseph Rézeau

Re: Image (JPEG) filetype cannot be accepted.

by Ryan Scharfer -

Hi Joseph,

Maybe you can help me out.  I posted a couple of questions on my own, but havent received any responses, so I thought I would respond to yours.  : )  I m a beginner and I am working with Moodle for the first time.  Version 2.5. I wanted to create my first course, but I can't upload any files at all -- pdf, doc, ppt... with file picker.  In fact, I just tried to attached a screen shot of the error message I receive, but got a different error message -- that the file type is too big. But that message seems to occur only within this forum..

I would appreciate it if you could help!

 

Thank you.

In reply to Mary Cooch

Re: Image (JPEG) filetype cannot be accepted.

by Emmanuel Mbilu -

Hi, I had the same problem but I succeeded by doing the following:

I had 15 users that I wanted to upload their pictures. I selected all the fifteen users and right clicked and then send to compressed (zipped) folder.

I went to ny moodle site and uploaded the compressed folder. It worked just fine!!

If you do just as I did, you will succeed!

In reply to Joseph Rézeau

Re: Image (JPEG) filetype cannot be accepted.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Glad to announce that a fix for this bug (MDL-33391) has been found and is currently being tested.

Joseph

In reply to Joseph Rézeau

Re: Image (JPEG) filetype cannot be accepted.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Bug is fixed.

In reply to Joseph Rézeau

Re: Image (JPEG) filetype cannot be accepted.

by Teemu Koistinen -

Hi


I am getting same error (filetype cannot be accepted) when trying to drag and drop image to Edit profile -page.

Same image uploads just fine using Upload a file -dialogue.

Chrome 20, Moodle 2.3 (Build: 20120625)

In reply to Teemu Koistinen

Re: Image (JPEG) filetype cannot be accepted.

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

I do not see any problem using Moodle 2.3.4+ (Build: 20130208).

Joseph

In reply to Joseph Rézeau

Re: Image (JPEG) filetype cannot be accepted.

by Toneee Dot Com -

Here it is a year later and this bug still seems to surface. I tried to upload or link to a GIF without success. Is this actually due to upload folder permissions?

 

 

Attachment 5224ed76c6ba5d23ad000023.jpeg