• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Uploading a file other than an image.

 
Ranch Hand
Posts: 85
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi fellas, I'm writing an application that will allow a user to upload a .pdf, .doc or .xls file. I still get an error whenever I upload that: The screen shot must be a GIF, JPEG, or PNG image file no greater than 3200000 KB in size. Isn't it possible to upload a pdf/doc(x) file in php and store it in a database of MySql. This program works well if i upload image file within the specified size. Learning sometimes can be frustrating!

The addscore script that should allow .pdf and co:


The appvars.php code:


This is the index page:


Thank you in anticipation.

 
Ranch Hand
Posts: 71
PHP Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are using the wrong mime types. For example, a .docx file uses the mime type application/vnd.openxmlformats-officedocument.wordprocessingml.document. Here is a list of the various Microsoft Office document mime types:
http://filext.com/faq/office_mime_types.php

I'll let you Google for the other mime types.

By the way, why not add the mime type to the error message on lines 91-92, that is a good way to find out mime types of file types that you can't handle.
 
Shamsudeen Akanbi
Ranch Hand
Posts: 85
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You bro, it worked like a charm! The only problem i'm facing now is that now that i can upload pdf and doc files, i can't upload pictures anymore. It has to do with something in my script so i'm trying to sort it myself. Thank you once again.
 
Did you ever grow anything in the garden of your mind? - Fred Rogers. Tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic