[OJS3.0] Unable to upload logo, no image from previous version, broken PDF link

Hi @zackzaidi78

Some PDFs there don’t work because they were imported using XML import which had a bug at that time. But other, that are uploaded normally works well, e.g. http://journals.sfu.ca/present3/index.php/demojournal/article/view/6/9. For those not-working PDFs there, no files exist in the system – they were not imported because of the bug.
I just checked the logo upload there and it worked for me i.e. I do not get the error you did. There are just no logos used there.
When I however remove permissions for the web user from my public folder (where logo images are saved), I get the same error as you, so I still believe you might have a problem with permissions for the web user on your public folder. And as far as I understand, your PDF files are there, in the file folder, thus also this is not the same problem as in the OJS official demo installation.

Best,
Bozana

Hi…
Ok, i finally manage to upload the journal cover, but later I found out the I need to CHMOD all the folders under PUBLIC including all cover journal to 755, then the logo can load.

And all my PDF in the FILES folder cannot load if click from the website. the PDF apps show “Message: stream must have data” error.

I still can’t upload the logo of the website as it gave “No file uploaded or invalid file type”. Both got erre if using JPG or PNG files.

Please help…

i have same problem with you. my journal unable to upload logo file or pdf or doc. have you an solution for your problem? please tell me if you have an solution.

not at this moment. sorry @Paisun. I’ve already corrected the folder permission but the problem still persist.

like this @zackzaidi78?

Hi @zackzaidi78 and @Paisun

Unfortunately I cannot reproduce the second problem of @zackzaidi78 with the message “No file uploaded or invalid file type” :frowning:
However, both file and public folder and everything in them have to be readable and writable for the web user for this to work…
@zackzaidi78, if your file folder also readable and writable for the web user?

Best,
Bozana

yes but not all folder i put 755, only files and public folder.

yes. all files and public folder are writeable for web user. alos tested using 777… but no success.

Note that it is important to identify not only the “mode” of the file permissions, such as 0755 or 0664, but also the user and group “owner” of the file.

In the can of @Paisun, the user and group ownership is represented in FileZilla as numeric values of “1260”. This may indicate a shared host, where the webserver may be running as the user “1260”.

The cause of the problem may also be filetype detection rather than file permissions.

OJS 3.0.1 will do this a bit better than OJS 3.0.0 because of this patch:

Hi,

I’m also stuck with this issue now

I have all folders 777 permissions just to test but still now luck. I have also changed the user and group to www-data:www-data. I have also tried both png and jpg images but still get the following error

image

@Nardusg, we’ll need to know a bit more about your situation to help.

What version of OJS are you using, and in what kind of environment? What specific folders have you modified (or what commands did you run to modify them)? Have you looked at your PHP error log?

Reasons OJS might provide a message like this include:

  • The uploaded file was blocked by Apache or PHP (could be filesize limitations, etc)
  • The uploaded file was not able to be written to the filesystem (could be permissions, selinux or PHP restrictions)
  • The uploaded file could not be identified by type (could be code version or dependencies on external libraries)

Hi @ctgraham,

Thank you for the reply.
After strugling for a while I just ran the following 2 command on the entire folder :neutral_face:
chown -R www-data:www-data folder
chmod -R 755 /folder
I upgraded from 2.4.8 to 3.0.2
I have a vps running on ubuntu 16.04.
I will have a look at the logs again.

Thanks again

The chown and chmod commands you specified look good for a Ubuntu install, if “folder” is the path to your files_dir and “public” and “cache” directories.

Let us know what you find in the error log.

@ctgraham, thank you for the feedback.

When I try to upload the file on the window below. There is no activity in the error log.
upload_error

But it return this error:

upload_error2

This is the console response from that ajax request

upload_error_3

The error log is full of the below notices tho, not sure why.

error_4

Not sure if I can provide you with any more info?

Regards

The PHP Notices about “Undefined indexes” for the local keys probably indicate that your 2.4.x install supported locales which 3.x does not yet have support for.

What other messages do you see, especially around the time at which you uploaded the file?

If I tail the log file while trying to upload the file, there are no errors in the log file, just a couple of those nitices that appear.
Is there someware in the code that I can debug or troubleshoot this? We have 5 OJS installations, that were all upgraded and I have this issue on all of them.

Regards

If you are comfortable with PHP debugging, take a look at the following function:

The calling context is:

	/**
	 * Save an uploaded file.
	 * @param $args array
	 * @param $request PKPRequest
	 * @return JSONMessage JSON object
	 */
	function saveFile($args, $request) {
		$fileUploadForm = $this->_getFileUploadForm($request);
		$fileUploadForm->readInputData();

		if ($fileUploadForm->validate()) {
			if ($fileUploadForm->execute($request)) {
				// Generate a JSON message with an event
				$settingName = $request->getUserVar('fileSettingName');
				return DAO::getDataChangedEvent($settingName);
			}
		}
		return new JSONMessage(false, __('common.invalidFileType'));
	}

You are falling through to the final return in that call, probably because $fileUploadForm->execute($request) is returning false.

Hi @ctgraham

Just some feedback, turns out all I had to do was comment this line in die config
[finfo]
;mime_database_path = /etc/magic.mime

and it worked.

Regards

2 Likes

My friend this solution was perfect, it served me correctly. I greatly appreciate it. Oh sorry google english hehehe