| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Simpel problem, butt can't make it work (Coldfusion)
Hi there,
When a user not provide a picture, i want to give the file field a default name like nopicture.jpg, so that we will not see a blank image placeholder butt a neat pic that tells us that no picture was provided. I allready tried in acces give default values but the filefield seems to overwrite these settings with (if the field by the user is left blank) a blank record, so no picture is shown. Well, it seems to be a simple problem, butt it's always and you just have to know, that makes it difficult sometimes huh... Thanks in advance Best regards, Marco |
|
#2
|
|||
|
|||
|
Well, if the user is submitting a form with an image file in it, I'd use PHP to do this:
Code:
// 'imagefile' is the form attribute name of the uploaded image
if (strlen($_FILES['imagefile']['name']) > 0) {
// give the filename a unique name using a timestamp
$filename = "($time_stamp)".$_FILES['imagefile']['name'];
// copy the file from the tmp directory to your home directory
copy ($_FILES['imagefile']['tmp_name'], "/full/path/to/dir/".$filename);
} else {
// if no filename, name it default.jpg
$filename = "default.jpg";
}
// now we insert the data into the database here
..... $filename ......
|
![]() |
| Viewing: Tutorialized Forums > Web Design & Development > ColdFusion > Simpel problem, butt can't make it work (Coldfusion) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|