Well I know how to upload image (.gif, .jpg, etc) resized, resample, add link to database fetch link and display images on webpage.

But now I need to be able to upload documents on server, add link in the database and be able to display those documents on the web, so is there any special requirements for that, specific mime type to be able to upload, and when you retrieve is it possible to either show a link that will open the document in the browser and/or open the download dialog box?

Any basic script that I can modify to my needs would be greatly appreciated.

4 Years
Discussion Span
Last Post by yats123

You can check mime types or file extensions.




You can do your tests on the temp file ($_FILES['...']['tmp_name'])

Once you successfully move an allowed tmp file to your uploads folder, just add a record to the DB. Include all the relevant data you think is impt.
If you don't want to store info in the DB, you can run various info retrieving functions dynamically, but there seems little point to this.

You can indeed show a link - built from the DB info held in the DB. If the mime type can't be handled by the browser, it'll download (I think!).


Thanks diafol with the resources provided I got it to work.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.