Re: [PHP-DB] upload images

2010-05-31 Thread 3dgtech
It could work, but be careful using timestamp or the php equivalent -  
microtime since this is reliant on gettimeofday(). If naming  
conventions don't mandate a sterilized format I woul still recommend  
using a confirmed new variable.

Just my two cents :-)
Eli

On May 30, 2010, at 10:04 PM, Karl DeSaulniers k...@designdrumm.com  
wrote:



Very good point. I did not think of that.
Change it from time() to the date + time() w/ seconds. Every second  
changes. Or better yet, milliseconds. Since that is the speed the  
script runs in I believe.


That should work. Yes?

Karl

Sent from losPhone

On May 30, 2010, at 6:57 PM, 3dgtech syst...@3dgtech.com wrote:

The problem with time() is that fast servers are too fast! (you  
will have processed multiple files before time() changes.) Add the  
$i from the for loop in multiple images to the end of your filename.



On May 30, 2010, at 4:33 PM, Karl DeSaulniers  
k...@designdrumm.com wrote:



Try this
Try assigning time() to a variable then add that to the rename.

EG:

if ($_FILES['foto']['type'] == image/jpeg ||
$_FILES['foto']['type'] == image/pjpeg){
 //nombre de la imagen
 $timestamp = time();
 //movemos la imagen.
 move_uploaded_file($_FILES['foto']['tmp_name'],
../fotografias/.$timestamp..jpg);

HTH,




Karl DeSaulniers
Design Drumm
http://designdrumm.com



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] upload images

2010-05-31 Thread Karl DeSaulniers

You are probably right.
The use of the $i and say photo_.$i..jpg would work better.

and change.. :)


Karl


On May 31, 2010, at 2:27 AM, 3dgtech wrote:

It could work, but be careful using timestamp or the php equivalent  
- microtime since this is reliant on gettimeofday(). If naming  
conventions don't mandate a sterilized format I woul still  
recommend using a confirmed new variable.

Just my two cents :-)
Eli

On May 30, 2010, at 10:04 PM, Karl DeSaulniers  
k...@designdrumm.com wrote:



Very good point. I did not think of that.
Change it from time() to the date + time() w/ seconds. Every  
second changes. Or better yet, milliseconds. Since that is the  
speed the script runs in I believe.


That should work. Yes?

Karl

Sent from losPhone

On May 30, 2010, at 6:57 PM, 3dgtech syst...@3dgtech.com wrote:

The problem with time() is that fast servers are too fast! (you  
will have processed multiple files before time() changes.) Add  
the $i from the for loop in multiple images to the end of your  
filename.



On May 30, 2010, at 4:33 PM, Karl DeSaulniers  
k...@designdrumm.com wrote:



Try this
Try assigning time() to a variable then add that to the rename.

EG:

if ($_FILES['foto']['type'] == image/jpeg ||
$_FILES['foto']['type'] == image/pjpeg){
 //nombre de la imagen
 $timestamp = time();
 //movemos la imagen.
 move_uploaded_file($_FILES['foto']['tmp_name'],
../fotografias/.$timestamp..jpg);

HTH,




Karl DeSaulniers
Design Drumm
http://designdrumm.com



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] upload images

2010-05-31 Thread Karl DeSaulniers

Good to hear.

Karl

Sent from losPhone

On May 31, 2010, at 2:41 PM, Emiliano Boragina emiliano.borag...@gmail.com 
 wrote:


Thanks a lot... this last solution is the best for me... thanks a  
lot to all!!!


2010/5/31 Karl DeSaulniers k...@designdrumm.com
You are probably right.
The use of the $i and say photo_.$i..jpg would work better.

and change.. :)


Karl



On May 31, 2010, at 2:27 AM, 3dgtech wrote:

It could work, but be careful using timestamp or the php equivalent  
- microtime since this is reliant on gettimeofday(). If naming  
conventions don't mandate a sterilized format I woul still recommend  
using a confirmed new variable.

Just my two cents :-)
Eli

On May 30, 2010, at 10:04 PM, Karl DeSaulniers  
k...@designdrumm.com wrote:


Very good point. I did not think of that.
Change it from time() to the date + time() w/ seconds. Every second  
changes. Or better yet, milliseconds. Since that is the speed the  
script runs in I believe.


That should work. Yes?

Karl

Sent from losPhone

On May 30, 2010, at 6:57 PM, 3dgtech syst...@3dgtech.com wrote:

The problem with time() is that fast servers are too fast! (you will  
have processed multiple files before time() changes.) Add the $i  
from the for loop in multiple images to the end of your filename.



On May 30, 2010, at 4:33 PM, Karl DeSaulniers k...@designdrumm.com  
wrote:


Try this
Try assigning time() to a variable then add that to the rename.

EG:

if ($_FILES['foto']['type'] == image/jpeg ||
$_FILES['foto']['type'] == image/pjpeg){
//nombre de la imagen
$timestamp = time();
//movemos la imagen.
move_uploaded_file($_FILES['foto']['tmp_name'],
../fotografias/.$timestamp..jpg);

HTH,


Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Karl DeSaulniers
Design Drumm
http://designdrumm.com


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] upload images

2010-05-30 Thread Emiliano Boragina
Hello, I want to do an Admin to upload more than one picture per clic, I
must can upload one or more Pictures. This I know how is it... but I want
rename each picture, not with , for example, 001 but with some function,
some... thing that rename the file. I am using this:

if(isset($_POST['submit'])){
$error = false;
// si hay imagen.
if (is_uploaded_file($_FILES['foto']['tmp_name'])) {
//revisamos que sea jpg
if ($_FILES['foto']['type'] == image/jpeg ||
$_FILES['foto']['type'] == image/pjpeg){
//nombre de la imagen
$foto = time()..jpg;
//movemos la imagen.
move_uploaded_file($_FILES['foto']['tmp_name'],
../fotografias/.$foto);
}else{
$error = true;
$errormsg = Formato no válido para archivo de
imagen;
}
} else {
//imagen no se pudo subir o no seleccionaron.
$error=true;
$errormsg = Error al cargar imagen:  .
$_FILES['foto']['name'];
}//fin file upload.

//continuamos con el insert.
//si hay error no hay imagen.
if($error){
$foto = ;
}

$titulo = $_POST['titulo'];
$texto = $_POST['texto'];
$categoria = $_POST['categoria'];
$habilitar = $_POST['habilitar'];
$campos = titulo,texto,foto,categoria,habilitar;
$valores = '$titulo','$texto','$foto','$categoria','$habilitar';
//nos conectamos a la bd.
$cnx = conectar();
$res = mysql_query(INSERT INTO registros ($campos)
VALUES($valores)) or die (mysql_error());
//cerramos la conexión.
mysql_close($cnx);
//mensaje de exito.
$mensaje = El registro ha sido ingresado;
exit;
}

?

If you can help me... I thanks a lot... If not... I thanks a lot anyway =D
Best regards!

--
Emiliano Boragina
desarrollos + comunicación
--
+ 15 33 92 60 02
» emiliano.borag...@gmail.com
--
© 2010
--



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] upload images

2010-05-30 Thread Karl DeSaulniers

Try this
Try assigning time() to a variable then add that to the rename.

EG:

if ($_FILES['foto']['type'] == image/jpeg ||
$_FILES['foto']['type'] == image/pjpeg){
//nombre de la imagen
$timestamp = time();
//movemos la imagen.
move_uploaded_file($_FILES['foto']['tmp_name'],
../fotografias/.$timestamp..jpg);

HTH,




Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP-DB] upload images

2010-05-30 Thread 3dgtech
The problem with time() is that fast servers are too fast! (you will  
have processed multiple files before time() changes.) Add the $i from  
the for loop in multiple images to the end of your filename.



On May 30, 2010, at 4:33 PM, Karl DeSaulniers k...@designdrumm.com  
wrote:



Try this
Try assigning time() to a variable then add that to the rename.

EG:

if ($_FILES['foto']['type'] == image/jpeg ||
$_FILES['foto']['type'] == image/pjpeg){
   //nombre de la imagen
   $timestamp = time();
   //movemos la imagen.
   move_uploaded_file($_FILES['foto']['tmp_name'],
../fotografias/.$timestamp..jpg);

HTH,




Karl DeSaulniers
Design Drumm
http://designdrumm.com



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Upload images with minimun effort from final user

2005-09-26 Thread David Arroyo
Hi @ll,

I have to make an interface for a newspaper site, where users can upload
news including images.

 

I want to store the image's name in a field of my NEWS table, in order to
catch it with an img tag later, but I don't want people has to upload the
image, remember its name, and put it as another field in the form.

 

Can anyone help me with an example, tutorial or any idea?

 

Thanks in advance,

David.

 



RE: [PHP-DB] Upload images with minimun effort from final user

2005-09-26 Thread Bastien Koert
Its pretty simple, the section in the manual has lots of detail on handling 
file uploads. The file's name is accessible thru


$name = $_FILES['formFieldName']['name'];

In this case, I would also suggest that you create the name of the image to 
store it on the file system..otherwise you may end up with N number of files 
with the same name (ie mycat.jpg). By associating another randomly generated 
name with the image as the true name, you should avoid that issue...


Bastien



From: David Arroyo [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Upload images with minimun effort from final user
Date: Mon, 26 Sep 2005 19:48:24 +0200

Hi @ll,

I have to make an interface for a newspaper site, where users can upload
news including images.



I want to store the image's name in a field of my NEWS table, in order to
catch it with an img tag later, but I don't want people has to upload the
image, remember its name, and put it as another field in the form.



Can anyone help me with an example, tutorial or any idea?



Thanks in advance,

David.





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Upload Images...

2002-12-27 Thread Doug Coning
Hi All,

I've got a question about creating an Update page.  I have an update page
that has a form with about 15 fields in it that update records in my MySQL
database.  One of the fields is an IMAGE field that stores an image name.  I
want to this PHP page to do several things:

1) edit and update the fields.
2) allow the user to upload new images to replace current images and then
update the image name in the image column.

Is this best served as 1 page or is it better to break this down into a page
to upload images and a separate page to edit the content?

Thank you.

Doug




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Upload Images...

2002-12-27 Thread Boaz Yahav
I'm guessing it's better for the people that will use this page to have
it all in one page
but less convenient for you to develop it like that :)

Sincerely

berber

Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.


-Original Message-
From: Doug Coning [mailto:[EMAIL PROTECTED]] 
Sent: Friday, December 27, 2002 9:09 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Upload Images...


Hi All,

I've got a question about creating an Update page.  I have an update
page that has a form with about 15 fields in it that update records in
my MySQL database.  One of the fields is an IMAGE field that stores an
image name.  I want to this PHP page to do several things:

1) edit and update the fields.
2) allow the user to upload new images to replace current images and
then
update the image name in the image column.

Is this best served as 1 page or is it better to break this down into a
page to upload images and a separate page to edit the content?

Thank you.

Doug




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Upload Images...

2002-12-27 Thread Doug Coning
Yes, but do you know where I can find a sample of merging the upload script
with the Update script?

Thanks!!!

Doug
- Original Message -
From: Boaz Yahav [EMAIL PROTECTED]
To: Doug Coning [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, December 27, 2002 1:09 PM
Subject: RE: [PHP-DB] Upload Images...


 I'm guessing it's better for the people that will use this page to have
 it all in one page
 but less convenient for you to develop it like that :)

 Sincerely

 berber

 Visit http://www.weberdev.com/ Today!!!
 To see where PHP might take you tomorrow.


 -Original Message-
 From: Doug Coning [mailto:[EMAIL PROTECTED]]
 Sent: Friday, December 27, 2002 9:09 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Upload Images...


 Hi All,

 I've got a question about creating an Update page.  I have an update
 page that has a form with about 15 fields in it that update records in
 my MySQL database.  One of the fields is an IMAGE field that stores an
 image name.  I want to this PHP page to do several things:

 1) edit and update the fields.
 2) allow the user to upload new images to replace current images and
 then
 update the image name in the image column.

 Is this best served as 1 page or is it better to break this down into a
 page to upload images and a separate page to edit the content?

 Thank you.

 Doug




 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Upload Images...

2002-12-27 Thread Aaron Wolski
Write your own.

You'll spend more time trying to find something than it will take you to
create your own. Plus.. anything that you do find will need
modifications anyway so may as well write your own.

Define the scope/parameters
Write out the logic
Program the script

:)

Aaron

-Original Message-
From: Doug Coning [mailto:[EMAIL PROTECTED]] 
Sent: December 27, 2002 3:29 PM
To: Boaz Yahav; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Upload Images...

Yes, but do you know where I can find a sample of merging the upload
script
with the Update script?

Thanks!!!

Doug
- Original Message -
From: Boaz Yahav [EMAIL PROTECTED]
To: Doug Coning [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, December 27, 2002 1:09 PM
Subject: RE: [PHP-DB] Upload Images...


 I'm guessing it's better for the people that will use this page to
have
 it all in one page
 but less convenient for you to develop it like that :)

 Sincerely

 berber

 Visit http://www.weberdev.com/ Today!!!
 To see where PHP might take you tomorrow.


 -Original Message-
 From: Doug Coning [mailto:[EMAIL PROTECTED]]
 Sent: Friday, December 27, 2002 9:09 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Upload Images...


 Hi All,

 I've got a question about creating an Update page.  I have an update
 page that has a form with about 15 fields in it that update records in
 my MySQL database.  One of the fields is an IMAGE field that stores an
 image name.  I want to this PHP page to do several things:

 1) edit and update the fields.
 2) allow the user to upload new images to replace current images and
 then
 update the image name in the image column.

 Is this best served as 1 page or is it better to break this down into
a
 page to upload images and a separate page to edit the content?

 Thank you.

 Doug




 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Upload Images...

2002-12-27 Thread Boaz Yahav
Is there something you don't know how to do or are you just looking for
something ready made?

Sincerely

berber

Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.




-Original Message-
From: Doug Coning [mailto:[EMAIL PROTECTED]] 
Sent: Friday, December 27, 2002 10:29 PM
To: Boaz Yahav; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Upload Images...


Yes, but do you know where I can find a sample of merging the upload
script with the Update script?

Thanks!!!

Doug
- Original Message -
From: Boaz Yahav [EMAIL PROTECTED]
To: Doug Coning [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, December 27, 2002 1:09 PM
Subject: RE: [PHP-DB] Upload Images...


 I'm guessing it's better for the people that will use this page to 
 have it all in one page but less convenient for you to develop it like

 that :)

 Sincerely

 berber

 Visit http://www.weberdev.com/ Today!!!
 To see where PHP might take you tomorrow.


 -Original Message-
 From: Doug Coning [mailto:[EMAIL PROTECTED]]
 Sent: Friday, December 27, 2002 9:09 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Upload Images...


 Hi All,

 I've got a question about creating an Update page.  I have an update 
 page that has a form with about 15 fields in it that update records in

 my MySQL database.  One of the fields is an IMAGE field that stores an

 image name.  I want to this PHP page to do several things:

 1) edit and update the fields.
 2) allow the user to upload new images to replace current images and 
 then
 update the image name in the image column.

 Is this best served as 1 page or is it better to break this down into 
 a page to upload images and a separate page to edit the content?

 Thank you.

 Doug




 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php