PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 22nd, 2012, 11:00 AM
xxPIRANHAxx xxPIRANHAxx is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Posts: 35 xxPIRANHAxx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 57 m 13 sec
Reputation Power: 1
Question Uploading images

hey guys,

Im making a car website, that allows the user to log in online and enter vehicles he is trying to sell. This website is meant for one to three users(by one user i mean one-3 people that can actually log in). I have successfully set up the part where the user can add vehicles, and its information. This all works with mysql. Now, im stuck at the part where the user can upload images with the car. I am completely lost. I have read that you can do either upload images to mysql or upload them to your website folder. I dont know how either of those versions work. Please can anyone help me. I need a way for the user to upload images with a vehicle entered. I am completely lost....

Please any help is accepted,
thanks
xxPIRANHAxx

Reply With Quote
  #2  
Old November 22nd, 2012, 11:40 AM
msteudel's Avatar
msteudel msteudel is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Sep 2002
Location: Seattle, U.S.A.
Posts: 712 msteudel User rank is Lance Corporal (50 - 100 Reputation Level)msteudel User rank is Lance Corporal (50 - 100 Reputation Level)msteudel User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 4 Days 11 h 4 m 59 sec
Reputation Power: 11
Quote:
Originally Posted by xxPIRANHAxx
hey guys,

Im making a car website, that allows the user to log in online and enter vehicles he is trying to sell. This website is meant for one to three users(by one user i mean one-3 people that can actually log in). I have successfully set up the part where the user can add vehicles, and its information. This all works with mysql. Now, im stuck at the part where the user can upload images with the car. I am completely lost. I have read that you can do either upload images to mysql or upload them to your website folder. I dont know how either of those versions work. Please can anyone help me. I need a way for the user to upload images with a vehicle entered. I am completely lost....

Please any help is accepted,
thanks
xxPIRANHAxx


This should help you out:

http://lmgtfy.com/?q=php+mysql+how+...ore+in+database

Reply With Quote
  #3  
Old November 22nd, 2012, 11:45 AM
xxPIRANHAxx xxPIRANHAxx is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Posts: 35 xxPIRANHAxx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 57 m 13 sec
Reputation Power: 1
Quote:
Originally Posted by msteudel


I knew that was gonna come!

thanks anyway

Reply With Quote
  #4  
Old November 22nd, 2012, 11:47 AM
msteudel's Avatar
msteudel msteudel is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Sep 2002
Location: Seattle, U.S.A.
Posts: 712 msteudel User rank is Lance Corporal (50 - 100 Reputation Level)msteudel User rank is Lance Corporal (50 - 100 Reputation Level)msteudel User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 4 Days 11 h 4 m 59 sec
Reputation Power: 11
Quote:
Originally Posted by xxPIRANHAxx
I knew that was gonna come!


So why didn't you do it first?! There are sooo many great tutorials out there that you can literally copy and paste their code into your application. Anyway check those out and then if you run into any specific problems come back and ask. Good luck!

Reply With Quote
  #5  
Old November 22nd, 2012, 11:48 AM
msteudel's Avatar
msteudel msteudel is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Sep 2002
Location: Seattle, U.S.A.
Posts: 712 msteudel User rank is Lance Corporal (50 - 100 Reputation Level)msteudel User rank is Lance Corporal (50 - 100 Reputation Level)msteudel User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 4 Days 11 h 4 m 59 sec
Reputation Power: 11
Oh and I would probably NOT upload images into the db. I don't think it's necessary and it cause your db to get really bloated.

Reply With Quote
  #6  
Old November 22nd, 2012, 01:19 PM
xxPIRANHAxx xxPIRANHAxx is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Posts: 35 xxPIRANHAxx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 57 m 13 sec
Reputation Power: 1
Quote:
Originally Posted by msteudel
Oh and I would probably NOT upload images into the db. I don't think it's necessary and it cause your db to get really bloated.


Then what other ways are there???

Reply With Quote
  #7  
Old November 22nd, 2012, 04:43 PM
msteudel's Avatar
msteudel msteudel is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Sep 2002
Location: Seattle, U.S.A.
Posts: 712 msteudel User rank is Lance Corporal (50 - 100 Reputation Level)msteudel User rank is Lance Corporal (50 - 100 Reputation Level)msteudel User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 4 Days 11 h 4 m 59 sec
Reputation Power: 11
Quote:
Originally Posted by xxPIRANHAxx
Then what other ways are there???


Just upload the image to the filessystem and then save the image location to the database. Go through those tutorials you'll probably find half a dozen showing you exactly what to do.

Reply With Quote
  #8  
Old November 22nd, 2012, 05:02 PM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,863 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 19 h 44 m 40 sec
Reputation Power: 813
Hi,

well, msteudel is of course right that this is standard stuff for which you can find tutorials everywhere.

However, since you asked about different methods, and since making the file upload secure isn't quite that trivial:

The standard solution is to simply put the files in the file system of the server. I guess you've already figured out how to put a <input type="file"> in the form and set the right method and enctype attribute of the form? In the target script, all information about the uploaded files will be available in the $_FILES array. The actual files are saved in a temporary directory. You can then move them with move_uploaded_file() to the right directory.

But you must be very careful with what and how you let users upload files to your server. For example, you certainly don't want people to upload and execute their own PHP scripts.

So make sure the uploaded file has a specific extension ("jp(e)g", "gif", "png") and check if it's actually an image with getimagesize(). Google for "php secure file upload" for further security considerations .

Reply With Quote
  #9  
Old November 26th, 2012, 05:35 PM
xxPIRANHAxx xxPIRANHAxx is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Posts: 35 xxPIRANHAxx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 57 m 13 sec
Reputation Power: 1
Quote:
Originally Posted by Jacques1
Hi,

well, msteudel is of course right that this is standard stuff for which you can find tutorials everywhere.

However, since you asked about different methods, and since making the file upload secure isn't quite that trivial:

The standard solution is to simply put the files in the file system of the server. I guess you've already figured out how to put a <input type="file"> in the form and set the right method and enctype attribute of the form? In the target script, all information about the uploaded files will be available in the $_FILES array. The actual files are saved in a temporary directory. You can then move them with move_uploaded_file() to the right directory.

But you must be very careful with what and how you let users upload files to your server. For example, you certainly don't want people to upload and execute their own PHP scripts.

So make sure the uploaded file has a specific extension ("jp(e)g", "gif", "png") and check if it's actually an image with getimagesize(). Google for "php secure file upload" for further security considerations .


Sorry I havent responded...
I hope to try the upload to folder one this weekend as I will have more time to invest then. I will post more...
thanks for all the help for now thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Uploading images

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap