Jump to content

picture upload/file download


astralaaron

Recommended Posts

Hello, I need to add an option to my admin panel where I can upload pictures and store the filenames in a database so they can be displayedin picture galleries.just looking for any tips / game plans for this, :)also I want to have something similar that uploads videos and displays a download link / some infomy question here is just how to have a link open up a download to a file in your site? i imagine that to be very basic.. i just never learned.thanks in advance to anyone that even read this.A

Link to comment
Share on other sites

my question here is just how to have a link open up a download to a file in your site?
You mean so that when someone clicks on the link, it prompts them to download the file? Just link to it normally
<a href="downloadthis.exe">Click to download downloadthis.exe</a>

Or do you mean how to have a system for people to upload files to your site? Have a look here:http://www.w3schools.com/php/php_file_upload.asp

Link to comment
Share on other sites

well i need the administrator to be able to upload pictures into picture galleries and have the pictures get displayed in a table, maybe thumbnails where you can click on them to open up the big picture.he should also be able to create new galleries (make a new folder) and then put pictures into there and have them displayed in a table..hope it makes sense.... it makes sense to me..also i need the administrator to be able to upload videos and have the download links / info displayed in tables...

Link to comment
Share on other sites

well i need the administrator to be able to upload pictures into picture galleries and have the pictures get displayed in a table, maybe thumbnails where you can click on them to open up the big picture.
Did you look in http://www.w3schools.com/php/php_file_upload.asp ?
have the pictures get displayed in a tablehave the download links / info displayed in tables...
Have a look at the glob() function (strange name...): http://au2.php.net/manual/en/function.glob.php
Link to comment
Share on other sites

I've got a small gallery that I wrote to teach myself about using databases, you can look through that if you want. The only thing that differs between it and what you want is that mine saves the actual images in the database as well, not just the filenames. It's faster to just store the images as files, it takes a little bit of extra time for PHP to get the binary data from the database and output the image. If you want to look through it it's online here:http://manchine.net/steve/files/gallery.zipThe only caveat is that I wrote that many years ago, so the code isn't exactly a shining example of best practices.

Link to comment
Share on other sites

I've got a small gallery that I wrote to teach myself about using databases, you can look through that if you want. The only thing that differs between it and what you want is that mine saves the actual images in the database as well, not just the filenames. It's faster to just store the images as files, it takes a little bit of extra time for PHP to get the binary data from the database and output the image. If you want to look through it it's online here:http://manchine.net/steve/files/gallery.zipThe only caveat is that I wrote that many years ago, so the code isn't exactly a shining example of best practices.
You are a genius.I have only seen the index.php file in my editor, it is looking very complicated.. hopefully when I get some time to look at it I will be able to figure it out :)thanksEDIT***How do i make this work???
Link to comment
Share on other sites

ok the page opens, but i had to manualy create a database called galleriesbut theres no tablesthe page opens with this on the left sideWarning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\jsg\index.php on line 572There are currently no galleries. Please choose from the menu below to set up a new gallery.Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\jsg\index.php on line 601--------------------------------------------------------------------------------i put in the password and it opens up controls to add galleries and images but the database isnt set up..it is really nice how you did it from what i can see...

Link to comment
Share on other sites

Did you miss the giant comment in index.php:

# Setup:## 1. Store all PHP files in the same folder. Create a temporary folder for use# when unzipping (i.e. 'zip_temp'). Make sure to give the server permissons to# read/write to the temporary folder.# NOTE: you MUST have a folder called 'zip_temp' with write access for the# zip file functionality to work. If you want to use a different folder name,# find the section in this file with the header 'upload entire gallery' and# edit the hard-coded path.## 2. Edit db_con.php to specify the database server, database name, user name,# and password for the MySQL server.## 3. Edit functions.php to set the admin password. Further instructions are in# functions.php. Also note the write_head function, this is the first HTML that# gets outputted and so contains the stylesheet paths, etc. Edit the paths if# necessary (if you move the CSS sheet).## 4. Edit this file (index.php), in the program variables section below. Set# the default thumbnail size you want to use, the temporary zip folder you# set up, and the name of the gallery. See ~50 lines below for this section.## 5. Execute create_db.php to set up the database. This script uses db_con.php# to connect to the database, so db_con must be set up first. To execute the# script, simply point your browser to the page. ex: http://localhost/create_db.php# If the script doesn't give any errors, it's all good. The script doesn't give# any output if it ran successfully.## 6. Edit the CSS sheet to pimp out the appearance.## 7. Enjoy. See below for proper, officialy sanctioned enjoyment guidelines.
Link to comment
Share on other sites

Storing names in the database will be quicker for users then storing files, there is some overhead involved when PHP has to get the binary data from the database and send it to the browser, it's quicker if the browser just asks the server for the image by name.All you have to do to set up the database is to edit the db_con file with the connection information (you have to make the database first, you don't need to make the tables though), then just run the create_db file in the browser. Once you do that you can check back with phpMyAdmin to see the tables that were created. Or, you can open the create_db file in a text editor and either copy and paste the SQL code directly into phpMyAdmin or just look at the SQL code and set the tables up yourself the same way.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...