![]() |
|
? |
![]() PHP FAQ PHP Articles PHP Help Bulletin Board PHP Manual (NEW!) First Time PHP'ers Help with programming Sql assignment help PHP Homework Help
|
? |
|
||||||||||||||||||||||||||||||
?Reply To This Message | |||||||||||||||||||||||||||||||||
?Your Name: | |||||||||||||||||||||||||||||||||
?Your Email: | |||||||||||||||||||||||||||||||||
?Subject: | |||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||
Email replies to this thread, to the address above. | |||||||||||||||||||||||||||||||||
??wrote: > > At the moment I have the following code that uploads images > to my server (see below). Prior to this code, I have a file > form that allows me to "browse" for a file on my computer, > then submit it, then this code runs..... > > if ($file1) > { > $pathonserver = "D:\\INETPUB\\12345ABC\\image\\upload\\"; > $fileonserver = $pathonserver."".$file1_name; > // BEGIN FILE UPLOAD > copy($file1, "$fileonserver"); > unlink($file1); > $photo1 = $file1_name; > } > > After the file is uploaded, I have my page update my table to > store the image name ($photo1 is the variable that is stored > in the table). > > Now, here's what I want to do. At the moment, the "file_name" > is whatever the file name was when I uploaded it. I do not > want that. I want my code to rename the file. So, if I upload > c:/image.jpg, I want the image renamed to.... > > $file_name=$rowid."_".$rowtitle; > > This way, I can ensure all the images have different names > and none copy over any other photos on the server. Basically, > I'm not sure how to easily do this.... If I edit the name > prior to the "$fileonserver" line, then the file doesn't get > uploaded. > > Any ideas? ">??![]() |