Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,209,536 members, 8,006,412 topics. Date: Tuesday, 19 November 2024 at 01:29 AM |
Nairaland Forum / Science/Technology / Webmasters / Please I Need Help In Uploading Photo In Form. (1048 Views)
Problem In Uploading Web Script / Frontpage Opt-in Form... / How Do I Solve This Problem In Uploading My Joomla Website (2) (3) (4)
Please I Need Help In Uploading Photo In Form. by charliebiz(m): 3:57pm On Sep 02, 2008 |
Please call somebody give me an idea of how to make an image appear in a form when it is uploaded while filling a form and how to do it. Also how to query or include a search option in my site which will give the result of person(s) filling the form including the passport fotograph uploaded. If possible refer my to a site where i can get the script from. |
Re: Please I Need Help In Uploading Photo In Form. by ThePhantom(m): 1:43am On Sep 03, 2008 |
Check this feature out on http://mynigeriapics.com/upload/ if this is something that you talking about then I can help you out |
Re: Please I Need Help In Uploading Photo In Form. by charliebiz(m): 9:32am On Sep 03, 2008 |
@phantom something similar to that. Actually, what i wanted is a form that has a passport photograph box with specification of the width and height and how to qeury/search for the data in my database for it to be displayed in a page. E.g, An umemployed accountant submits a resume and the employer searches the database for Accountants then wolla, the list of accountants pops up with their bio data. I have a faint idea of how i want it to look like so i need more suggestions, contribution and help with the code. Expecting your reply. |
Re: Please I Need Help In Uploading Photo In Form. by yawatide(f): 3:18pm On Sep 03, 2008 |
@charliebiz I think you are talking 2 different things - uploading photo and querying db for info, but I could be wrong. Be that as it may, it sounds like u want to do something like Phantom has. All you would do is specify via text to the user the dimensions of the photo and file extension and on the backend, check to make sure the photo to be uploaded matches the criteria. I would then store the path to the photo, not the photo itself in the db, for space reasons, along with other fields. Then you query the db for a particular information and the uploaded photo, along with other fields, gets displayed on a results page. that's how i c it |
Re: Please I Need Help In Uploading Photo In Form. by charliebiz(m): 4:15pm On Sep 04, 2008 |
@ yawatide Yah,you were right. i av two question there. thank you for your reply but will the path be reliable, looking at a long period useability since the pictures are not being stored and only the pathway and please can you give me an idea of how to make the form information fall into the right table of my database when filled.Example, I am applying for a job as an accountant, my biodata fall under the table of Accountant and another person is applying for Waiter, the person's biodata falls under the waiter table. I will appreciate if you really soonest. i know others are learning. You & others av alway been a reason y i turn to this forum for resource. Thanks. |
Re: Please I Need Help In Uploading Photo In Form. by nduaj(m): 5:12pm On Sep 04, 2008 |
i can help out, lemme ave ur contact details. i'll buzz yu. |
Re: Please I Need Help In Uploading Photo In Form. by yawatide(f): 5:21pm On Sep 04, 2008 |
in addition to what nduaj has said, I will state the little that I know. Please bear in mind that I am not a DBA: You will have at the least, 2 tables: 1a) Jobs table that has the person's name, address, title, photo, etc 1b) To ensure database normalization, you probably don't want to have the job titles repeat themselves so you could assign a number to those titles. This is where the 2nd table comes in 2) Titles table that has 2 fields: field 1 has the job id and field 2 has the actual job title 3) In Jobs table, job id is secondary key while in titles table, job id is primary key 4) You probably also want to have some unique id for the jobs table. maybe one u can auto increment 5) maybe you index the name and job title fields 6) For the photos, since you aren't hardcoding the folders where the photos are stored but creating them on the fly, I don't see any reason why you should have the concerns you state. As long as you are linking to them absolutely, you can move the same code to another server and still not have any problems. Here is how I have done it: Say you have a unique id for jobs table. Let's just say for sake of argument, the number for the first entry is "1". so you store the photo under: /images/photos/1/1.jpg. You create the "1" folder on the fly and store 1.jpg in that folder. So in this case, you aren't technically even storing even the file path in the DB. You just call the path on the fly on the page concerned. Make sense? Conclusion: You won't and shouldn't have separate accountant and waiter tables. What you should have is a table for the person's info and another table (at the very least) that list the job titles. |
Re: Please I Need Help In Uploading Photo In Form. by charliebiz(m): 11:51am On Sep 05, 2008 |
@ Yawa-ti-de Thank you in a million. That was an insightful explanation. I thought i had cracked the nut and came out with the solution when i was dreaming last nite until i opened my resource heaven (Nairaland) and i read your reply. I will put what you said into practise and see what comes out of it. @ Nduaj Thank you for your interest in helping out. I would appreciate if you make your own comment here so that others will learn. I know some forumites are interested in this. Here are my contact. charlie4biz@gmail.com, 08026640451 |
Re: Please I Need Help In Uploading Photo In Form. by Nobody: 1:43am On Sep 08, 2008 |
I am sorry if i made a wrong insinuation (i always skim thru threads) it is a bad idea creating folders for each user, its better you name the images using their usernames and storing the image names(not paths) in the database against each user for the search, you build sql queries, something like select * from table where column1 like something or column2 like something or column3 like something |
Re: Please I Need Help In Uploading Photo In Form. by yawatide(f): 11:47am On Sep 08, 2008 |
@webdezzi: it is a bad idea creating folders for each user, its better you name the images using their usernames and storing the image names(not paths) in the database against each user out of curiosity, could you explain further (in particular the folder part)? I would love to learn. Also, when you store the image names in the DB, where are the actual images saved (as in folders)? Thanks, |
Re: Please I Need Help In Uploading Photo In Form. by charliebiz(m): 11:30am On Sep 09, 2008 |
@ webdezzi We are waiting for your reply especially me. I am still . |
Re: Please I Need Help In Uploading Photo In Form. by nduaj(m): 5:38pm On Sep 09, 2008 |
hi guys, am so sori i was late in replyin but now dat mi here.lemme suggest the way 4ward. What you need to do is, create a folder in your sever for your pictures, then in addition to the fields for each record that goes into the database, add a field called 'imagepath'. this field will store the path to the picture in the folder you created. So in the code where yu wanna display the image, instead of having <img=pictures/mypic.jpeg> you can have <img=<? echo $row['imagepath']; ?> > dis way, it will display the image that was stored for that record. It really an easy algorithm, i hope i didnt confuse anyone with it. thanks @poster, i will send you an email |
Re: Please I Need Help In Uploading Photo In Form. by yawatide(f): 5:47pm On Sep 09, 2008 |
@nduaj So, if you have 1 million users, you will store 1 million photos in the same folder? Better yet, if they eventually have more than one photos, again, they all go in the same folder? Not saying it is wrong but in the name of abstraction, my solution (not necessarily the best one) has always been to insert photos in separate folders as in the future, you might say, want to do more than just hv the one photo. That way, my photos aren't mingling with urs. Again, both our solutions get the job done. I just happen to like abstracting my solutions out upfront. |
Re: Please I Need Help In Uploading Photo In Form. by nduaj(m): 9:21am On Sep 10, 2008 |
@ yawatide well, yes, u can store one million photos in the same folder, and retrieve them uniquly by querying the database. if yu want to have more than one photo per user(like what you have in a social network), u then create a table that stores the users unique id number and the filepath of the various photos. when yu want to dispaly his bio data and pictures at the same time, u can use the SQL LEFT JOIN function. this will work vey well. am definately not saying you are wrong , this has worked for me so far. |
Re: Please I Need Help In Uploading Photo In Form. by charliebiz(m): 11:23am On Sep 10, 2008 |
@ contributors Thank you guys, you av done alot . I don't know if i should say this is the end of this trend but i think i will be back if i have any other trouble with it. @ Viewers Thank you for learning with me, if you are ignorant as i am. @ Nduaj I am still waiting for your mail. Thanks |
Re: Please I Need Help In Uploading Photo In Form. by ThePhantom(m): 7:34pm On Sep 10, 2008 |
@ Poster Very Sorry got very busy, but it looks like others have helped. Just want to comment on storing images. It depends on the kind of site You have, if it is like a social network site I believe it is best to create a folder for each user to store their pictures. A site like charliebiz's can just make use of a folder to store all the pictures since there are no members and also you create a process to rename the pictures to make them like time stamps e.g. myimage.jpg > myimage_20080910_072422.jpg this way the name id unique. |
Re: Please I Need Help In Uploading Photo In Form. by yawatide(f): 7:50pm On Sep 10, 2008 |
@ThePhantom Thanks for coming to the rescue. As my posts have pretty much inferred, I am talking from an abstraction point of view. The time stamp option is very good as well but I personally believe in the "What happens if the client wants something else?" approach. It shouldn't really matter if you are talking facebook or babajidebook (hopefully, you all catch the humor there ). To me, that's like saying, "it's okay to hit let balls in lawn tennis when you are serving during practice cos its not the real game". Soon enough, you start hitting let balls during the real game when it counts. You have to be on your A-game always. Thinking outside the box and coding for the long run are always the first things on my mind whenever I code. I hate revisiting code that I have turned over to the client. Thanks |
Re: Please I Need Help In Uploading Photo In Form. by Nobody: 8:34am On Sep 15, 2008 |
yawa-ti-de: yes, you move uploaded images to any folder of your choice, and you need to do in your script is <img src="path_to_image_folder/<?php echo $r['imageColumn'];?>"> This is my idea and this is what i do I store them all in 1 folder and follow a naming convention like this username_timeOfUpload.extension, e.g webdezzi_125425276.jpg even when the time comes when for some not-yet-known reasons, you might want to create folders for each like you said, you can put up a script that VERY LOGICALLY check each file name, use the underscore to explode() the file name, and return the user who owns that file. and putting upgrade in mind always, i store the image filenames in a separate table linked to user's table, later on, your client might say, "we want users to be able to upload as many pictures as possible" and u know! you don't want to mess up the user's table with more columns This lines does the trick, please let me know if you have a better way of writing this, i will appreciate it
|
Re: Please I Need Help In Uploading Photo In Form. by castrolng: 5:16pm On Sep 15, 2008 |
The idea of creating a separate folder for each user is begging for a security problem like Remote File Inclusion(RFI) et al, nduaj is right. one folder for them all and make use of the db query to limit the results to for one user. storing the directory path in a db field with a corresponding field that identifies the owner or user_id. One thing @nduaj missed though is an issue that arises when using one folder to achieve this task, if two users upload a file with the same file name and extension then it overwrites an older file with the same filename and extension, to solve that part is easy, before storing the name of the file and the path in the database, encrypt/digest/randomize the file name to generate a unique file name that will never be repeated in the instant of the epoch. cheers, |
(1) (Reply)
Please I Need Videos For Jquery And Ajax / Its Been A While, Sorry I Quited Web Programming, Am now an AUTO Dealer! So Cool / How To Kill Domain Propagation Time (DNS Changes)
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 63 |