General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 6th, 2003, 05:08 AM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
how do I add and retrieve pictures?

I want to add and retrieve pictures dynamically. I thought that the article about BLOBBING might have been my solution, but I either didn't udnerstand it well enough or it just wasn't what I'm looking for. I thought an easy way to use pictures would be to have a user adda picture to the site with a form for browsing for the file and then giving the file a variable name equal to the filename. Then it would save the file in a picture directory, and add the name of the file to a database with auto incrementing numbers. Then when I wanted to pull a file up, I could use a qeury that calls for a file with a filename = $name. Is this even possible? Maybe I'm not thinking it though. At any rate, I want to have the user upload a file, and then have that file displayed dynamically. thank you.

Reply With Quote
  #2  
Old June 9th, 2003, 03:30 PM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
any help?

i still cant do it.... any ideas? thanks.

Reply With Quote
  #3  
Old June 10th, 2003, 07:37 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
thecharking,

Are you storing the actual file in the database, or just the path to the file?

If you're storing the path, what you need to do when retriving the file is make sur you're putting the value of your image variable (once retrieved) within <img> tags... Otherwise, you will not be able to see the image.

HTH!
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
  #4  
Old June 12th, 2003, 10:27 PM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
thanks... but...

Sorry I guess I didn't explain myself well enough. I am not sure of how to get the files in the first place. I am thinking using a form to gather the pictures to be placed in a folder would be best. Thank you.

Reply With Quote
  #5  
Old June 13th, 2003, 06:55 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Yeah,

It would be best to have a form whereby the user can choose which image to upload...

There's an article that deals exactly with that... I understand you read a blobbing article and it didn't help... Out of curiosity what problems were you having? I read that article, and actually based an application off of that... I found it helped very much...

What version of PHP are you running on your server? Did you receive any error messages when you attempted to create your script?

Reply With Quote
  #6  
Old June 14th, 2003, 05:33 AM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
info

yes I read the blobbing article, and implemented it into my site, which uses includes and uses the url index.php?page=$variable for everything pretty much. When I load ?page=getfiles, I get the getfiles page. I enter a short little word or something for description, and then I get my file. I click upload and get this message:
You must enter both a description and file
I tried just leaving that error checking out, because I am not too worried about getting a description at the moment.
I then tried upl,oading and got this message:

Warning: fopen("", "r") - Invalid argument in c:\phpdev5\www\prp\grabfile.php on line 25

Warning: fread(): supplied argument is not a valid File-Handle resource in c:\phpdev5\www\prp\grabfile.php on line 26

File Uploaded
The details of the uploaded file are shown below:

File name:
File type:
File size:
Uploaded to:

Add Another File

There are two database entries that I don't know where they came from, nor do they have anything in them but the blob id and blob data. These are not being sent by my pages now... so don't know how they got there. But they seem to be empty all the same.

I am running PHP version 4.2.2 on my windows XP PRO machine.

I have everything turned on coprrectly and such, I have checked these settings time and again while looking at different forum posts.

another wuestion I have:
won't blobbing simply put the picture into a database, and that eat up a lot of room and make for a large database? is there a way to just save the file to a folder, and then have it retrieved using php? I think that would be best... but maybe that is blobbing maybe I missed the point. I hope I didn't screw something up bad here. thanks so much, your help is much appreciated.

Reply With Quote
  #7  
Old June 17th, 2003, 05:17 PM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
just got another version

i just downloaded 4.2.3 of php... its the phpdev installer, and then i got the upgrade from 4.2.3 to 4.3.0, but it didn't work although it said it did. at any rate, i hope this isn't the cause of my problem. please let me know what to do if it isn't, or, if it is, for that matter. thanks.
__________________
hey it's the CHARKING

Reply With Quote
  #8  
Old June 18th, 2003, 05:25 AM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
what would work best

okay well i've been restless about the pictures thing, and really wanted to know what my site would look like with them implemented. so I set up a pretty good way of retireving pictures that I had placed in a folder in my site. It will work like this, assuming I am able to jsut allow people to add pictures to a folder from the site... I am still not sure of how, or if it is possible.

I am going to just use the picture name and turn it into a database row. That way it will jsut get the pic name by matching them. It works super well. Maybe it would be best to have the pictures sent to an admin email first any way, and then the admin can load the picture in... no that's too much work. sorry jsut thinking out loud... well silently but in type... anyway

If anyone can help with this, it's what I think would work best.
the user submits the picture. it is them placed in a temp picture folder, and then a php page (viewed by the admin) can just pull each pic up, maybe with a chechbox or something, you know, so when it is submited, it can input the data into the database according to variables already passed when the user put it into the temp folder.

i think (if this is possible) I could do most of this if I simply knew how to get the pictures in teh first place. it's something that has been bothering me for quite a while now, as most of my site is made up of this picture funtion.

Thanks for reading, I know, this must be tiresome. Lemme know also if maybe I am going about this in the wrng manner, if this is mroe difficult than it should be, but this seems good to me...
thanks!

Reply With Quote
  #9  
Old July 3rd, 2003, 07:13 PM
YettiDesign YettiDesign is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Brisbane, Australia
Posts: 5 YettiDesign User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
this is probably dead, but this is how i did it.. and maybe someone one day will be looking for the solution and they find it.

form to use:
<FORM NAME="imgupld" ENCTYPE="multipart/form-data" ACTION="getimg.php?sid=$sid" METHOD=post>
<INPUT TYPE="file" NAME="attach" SIZE=40>
<INPUT TYPE="Submit">
</FORM>


now the getimg.php file:


$ufolder = "/httpd/html/filesuploaded/";
if ($_FILES['attach']['name'] != "") {
//make sure file name is lower case.
$_FILES['attach']['name'] = strtolower($_FILES['attach']['name']);
//get rid of spaces
$_FILES['attach']['name'] = str_replace(' ', '_', $_FILES['attach']['name']);
//get rid of '$'
$_FILES['attach']['name'] = str_replace('$', '_', $_FILES['attach']['name']);

if ($_FILES['attach'] != "") {

copy($_FILES['attach']['tmp_name'], "$ufolder".$_FILES['attach']['name'])
or die("Couldn't copy the file!");

} else {

die("No input file specified");
}




or something along those lines... it probably wont work as is.. but the basis is there.
besides, im looking for a solution for something else :S

Reply With Quote
  #10  
Old July 3rd, 2003, 09:25 PM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to thecharking
thanks

thank you for the help, although yah the thread was dead, I figured it all out a while back sorry. And I too am now having a new problem.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > how do I add and retrieve pictures?


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT