Welcome Guest, Not a member yet? Register   Sign In
PDF upload issue
#1

[eluser]justmelat[/eluser]
Hi

I had a client that had a problem uploading a pdf file a couple of months ago. I posted the issue, but the client was able to upload other pdf's and doc types, so I let it go. We another client is having the same issue. Trying to upload a pdf, that at first glance looks fine, but won't upload. Other file type upload just fine and I see they have uploaded other pdf's.

In my searching I see others have had similar issues with various resolutions, but a few have mentioned that they look at the details of the file type as it is uploading.

How do I do that? I want to see what CI/PHP is uploading or thinks it's uploading.
#2

[eluser]eclarian[/eluser]
If you've been able to upload other PDF files, I would check what your file size limits are in your configuration as well as on the server itself. It is probably too low.

Also make sure to use
Code:
$this->upload->display_errors()

That will give you more detailed information. All the upload class is checking against is the extension (e.g. ".pdf") and whether it is one of the allowed_types that you passed. It isn't actually checking the mime type (at least to my knowledge).
#3

[eluser]justmelat[/eluser]
Thanks so much eclarian.

I decided to step back and check everything from the beginning. I went back to the php.ini file and found that the file limit was set to 2M instead of 10M. After checking out SVN code to verify the 10M setting, we determined that in the process of updating servers, the original php.ini and and few others were overwritten.

Thanks again for your comment, otherwise, it would have been days before I would have checked the php.ini since I was so positive it was still 10M.
#4

[eluser]eclarian[/eluser]
Glad I could help!
#5

[eluser]predat0r[/eluser]
Also can help extending config/mimes.php if you set pdf for allowed types but get error "not allowed file type.."

'pdf' => array('application/pdf', 'application/x-pdf', 'application/x-download','application/x-download', 'binary/octet-stream', 'application/unknown', 'application/force-download'),
#6

[eluser]eclarian[/eluser]
Mimes types are not involved with the upload process within CodeIgniter. Uploads are based purely off of the extension present on the file being uploaded.

Make sure you are setting your allowed_types correctly. This can either be done in the configuration or inline within your upload function. (reference: http://ellislab.com/codeigniter/user-gui...ading.html)

Make sure that you have something like this within your function. To allow for additional file types separate them by a pipe (e.g "pdf|csv|doc")

Code:
$config['allowed_types'] = 'pdf';
$this->load->library('upload', $config);


Make sense?




Theme © iAndrew 2016 - Forum software by © MyBB