store image path

i want to store image path into the data

  • (2 Pages)
  • +
  • 1
  • 2

18 Replies - 12025 Views - Last Post: 24 January 2013 - 04:36 PM Rate Topic: -----

#16 chitara  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 89
  • Joined: 16-December 05

Re: store image path

Post icon  Posted 27 December 2005 - 11:15 AM

Okay!! you people are right. I agree with you.

I also disagree the copy-paste method. I wnat to learn someting from you boss.

One thing let me inform you that yes, at last i have solve the problem in my own way. I didn't use wizzy's or others code. And I always use the code, even from the book after getting my heart otherwise i don't.

May be next time i'll apply wizzy's code in my other work, at least to see the effect. But now i m pretty much busy with my current project.

And hey bosses!! i'll knock you again & again unless i leave this php world.

Thanks to you

bye

Take care


Chitara

This post has been edited by chitara: 27 December 2005 - 11:22 AM

Was This Post Helpful? 0
  • +
  • -

#17 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1876
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: store image path

Posted 27 December 2005 - 11:36 AM

Glad to hear you were able to do it on your own and understand the code. Let us know if there is anything else we can help with! Good luck with your project.
Was This Post Helpful? 0
  • +
  • -

#18 Anna1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 24-January 13

Re: store image path

Posted 24 January 2013 - 04:18 PM

View PostWizzy, on 21 December 2005 - 03:52 PM, said:

It is actually easy to achieve this, here is an example:

The image link is retrieved from a form
<?php
$_POST[ 'imglink' ];
?>


Obviously, this would need to be verified as a img. This best way to do this is to find the .gif, .jpg
<?php
session_start();
$img = $_POST[ 'imglink' ];
$filetypes = array( 'gif', 'jpg' );
++$filetypes;
$filetype = strstr( $img, '.' );
if( $filetype != $filetypes )
{ echo 'not supported'; }
session_register( 'Image' );
?>


Then it could be inputted into a database
<?php
$DB = mysql_connect( 'localhost', 'root', 'password' );
mysql_select_db( 'ImageDB1' );
$Img = $_SESSION[ 'Image' ];
mysql_query( "INSERT into `IMAGES` ( `id`, `url` ) VALUES ( '', '$Img' )" );
session_destroy();
mysql_close( $DB );
?>


The id in table would need to be at least small int, with auto increment and primary key.
The url would need to be a varchar of 50 characters.

Hope this helped.


I would like to congratulate you. You represent the true nature of the internet. Share, explain and teach. I think the moderators can learn a lot from people like you. Teach people how to read and write but explain to them how to learn to write their own signature, don't hold back. Fight to teach the young and old what you know, and stand back to see what YOU helped create, it is a wonderful thing and don't let ANYONE tell you any different.

Plato was a student of Socrates do you think he held back and told Plato to DIY, I don't think so. Plato taught him so that HE would be better than he could ever hope to be. Moderators get real and teach as many people what you know so they can exceed anything that you could ever hope to be. Then and only then can you say that you have helped people. learn.
Was This Post Helpful? 0
  • +
  • -

#19 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,259
  • Joined: 27-December 08

Re: store image path

Posted 24 January 2013 - 04:36 PM

This thread is back from 2008. I don't see a reason to necropost this just to encourage people to do others' homework. I'm going to close this thread. You are welcome to shoot me a PM with any questions.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2