Welcome Guest, Not a member yet? Register   Sign In
Problem uploading .jar files using Upload class
#1

[eluser]Daniel H[/eluser]
Hi-

I wonder if anyone could help me here. I am trying to allow the upload class to upload both .jar and .jnlp files.

By adding

Code:
'jnlp' => 'application/x-java-jnlp-file',

in the mimes config file, I can allow uploading jnlp files. However I can't allow jar files, despite adding:

Code:
'jar' => array('application/java-archive', 'application/x-jar', 'application/x-java-jar', 'application/octet-stream')

($_FILES reports the file as a 'application/octet-stream').

Can anyone help me out here?

(Before you ask, my allow types config is $config['allowed_types'] = 'gif|jpg|png|jar|flv|jnlp'; )
#2

[eluser]Daniel H[/eluser]
Ah I have now discovered the issue: the octet mime is actually used for various other file types, such as images etc. So when the upload class tries to process the jar file it thinks it is an image, so tries to validate it using getimagesize, which will of course fail for a jar file.

Does anyone have any suggestions as to how I can amend the Upload class to allow octet stream to be used across file types?




Theme © iAndrew 2016 - Forum software by © MyBB