Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-17-2012, 01:57 AM   PM User | #1
Spudster
New Coder

 
Join Date: Jul 2012
Posts: 55
Thanks: 5
Thanked 0 Times in 0 Posts
Spudster is an unknown quantity at this point
PHP Image Uploading

I am working on a project and am currently doing the learning aspects of coding.

Anyway im trying to allow users to upload/share there own photos how can i allow users to upload photos to the server from there computer or a external link/ such as eg: google.com/images/image.png or jpg etc..

Thanks,

Spudster

PS: Im using
PHP Session Login
SQL Database
Spudster is offline   Reply With Quote
Old 07-17-2012, 02:22 AM   PM User | #2
DrDOS
Senior Coder

 
Join Date: Sep 2010
Posts: 1,155
Thanks: 10
Thanked 148 Times in 148 Posts
DrDOS is infamous around these parts
You can start the way I did, the way I nearly always do. Look up 'image upload example' on Google, download some of the example scripts, practice with them. Then, after you know a a bit more, come back and ask any more questions you need answered.
DrDOS is offline   Reply With Quote
Users who have thanked DrDOS for this post:
Spudster (07-17-2012)
Old 07-17-2012, 02:34 AM   PM User | #3
Spudster
New Coder

 
Join Date: Jul 2012
Posts: 55
Thanks: 5
Thanked 0 Times in 0 Posts
Spudster is an unknown quantity at this point
Thanks for the quick answer

Im hoping i can use the database todo this, some people on google say that it needs to be done by directoies...
Spudster is offline   Reply With Quote
Old 07-17-2012, 03:11 AM   PM User | #4
DrDOS
Senior Coder

 
Join Date: Sep 2010
Posts: 1,155
Thanks: 10
Thanked 148 Times in 148 Posts
DrDOS is infamous around these parts
Quote:
Originally Posted by Spudster View Post
Thanks for the quick answer

Im hoping i can use the database todo this, some people on google say that it needs to be done by directoies...
Yes, you need directories, you can either make temporary directories, have people make a directory with their username, or choice of name, and you can make sub-directories with their choice of names. The database will make it easier and better. The best way is to keep all the users directories in a 'big' directory that only has users directories in it, nothing else. That 'sandboxes' them from the rest of the files. Keep all the data in the database, although you can put some user files in their own directories. All very 'do-able' with php, just needs to be coded. Hve fun.
DrDOS is offline   Reply With Quote
Users who have thanked DrDOS for this post:
Spudster (07-17-2012)
Old 07-17-2012, 03:18 AM   PM User | #5
Spudster
New Coder

 
Join Date: Jul 2012
Posts: 55
Thanks: 5
Thanked 0 Times in 0 Posts
Spudster is an unknown quantity at this point
Ok Thanks, so how does facebook keep all there images in one folder how complex...

So if i keep all photos in a directory how do i make a delete/create direcotry with php? and make it echo it on a page & create the paths in the database?

This seems to be complicated..

Last edited by Spudster; 07-17-2012 at 03:32 AM..
Spudster is offline   Reply With Quote
Old 07-17-2012, 04:03 AM   PM User | #6
DrDOS
Senior Coder

 
Join Date: Sep 2010
Posts: 1,155
Thanks: 10
Thanked 148 Times in 148 Posts
DrDOS is infamous around these parts
Quote:
Originally Posted by Spudster View Post
Ok Thanks, so how does facebook keep all there images in one folder how complex...

So if i keep all photos in a directory how do i make a delete/create direcotry with php? and make it echo it on a page & create the paths in the database?

This seems to be complicated..
Facebook uses the database. The image files are all given new names, which are just sequential numbers, by using a queing function which just increments each time a new image needs to be named. No two numbered alike. The original name is kept alongside the new name in the database. There needs to be two databases, one for the users info, including a list of their photos by new name, and one for the new names and the old names. More info can be included in either one, but that is an absolute minimum. So you have to decide which one is more complicated, theirs or mine.
DrDOS is offline   Reply With Quote
Old 07-17-2012, 04:56 AM   PM User | #7
Spudster
New Coder

 
Join Date: Jul 2012
Posts: 55
Thanks: 5
Thanked 0 Times in 0 Posts
Spudster is an unknown quantity at this point
There one seems more simpler.

All I need todo is work out how to get an image to upload in the database and echo successfully.. I guess I can look this up on google.

I use tables to gather the info If I can get everything to be a one place it would make it a lot easier.

Thanks for your help im slowly starting to understand the aspect of this
Spudster is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:57 AM.


Advertisement
Log in to turn off these ads.